Report makeindex/xindy errors

Fixes #2569
This commit is contained in:
Juergen Spitzmueller 2019-12-15 13:48:21 +01:00
parent aa141bc293
commit 239dee34af
4 changed files with 63 additions and 5 deletions

View File

@ -1238,7 +1238,7 @@ def checkOtherEntries():
rc_entry = [ r'\jbibtex_command "automatic"' ],
alt_rc_entry = [ r'\jbibtex_alternatives "%%"' ])
checkProgAlternatives('available index processors',
['texindy $$x', 'makeindex -c -q', 'xindy $$x'],
['texindy $$x -t $$b.ilg', 'makeindex -c -q', 'xindy $$x -t $$b.ilg'],
rc_entry = [ r'\index_command "%%"' ],
alt_rc_entry = [ r'\index_alternatives "%%"' ])
checkProg('an index processor appropriate to Japanese',

View File

@ -188,6 +188,7 @@ int LaTeX::run(TeXErrors & terr)
{
int scanres = NO_ERRORS;
int bscanres = NO_ERRORS;
int iscanres = NO_ERRORS;
unsigned int count = 0; // number of times run
num_errors = 0; // just to make sure.
unsigned int const MAX_RUN = 6;
@ -302,6 +303,9 @@ int LaTeX::run(TeXErrors & terr)
runMakeIndex(onlyFileName(idxfile.absFileName()), runparams);
if (ret == Systemcall::KILLED)
return Systemcall::KILLED;
FileName const ilgfile(changeExtension(file.absFileName(), ".ilg"));
if (ilgfile.exists())
iscanres = scanIlgFile(terr);
rerun = true;
}
@ -426,7 +430,10 @@ int LaTeX::run(TeXErrors & terr)
file.absFileName(), ".idx")), runparams);
if (ret == Systemcall::KILLED)
return Systemcall::KILLED;
rerun = true;
FileName const ilgfile(changeExtension(file.absFileName(), ".ilg"));
if (ilgfile.exists())
iscanres = scanIlgFile(terr);
rerun = true;
}
// MSVC complains that bool |= int is unsafe. Not sure why.
@ -475,6 +482,9 @@ int LaTeX::run(TeXErrors & terr)
if (bscanres & ERRORS)
return bscanres; // return on error
if (iscanres & ERRORS)
return iscanres; // return on error
return scanres;
}
@ -516,6 +526,11 @@ int LaTeX::runMakeIndex(string const & f, OutputParams const & rp,
tmp = subst(tmp, "$$x", xdyopts);
}
if (contains(tmp, "$$b")) {
// advise xindy to write a log file
tmp = subst(tmp, "$$b", removeExtension(f));
}
LYXERR(Debug::LATEX,
"idx file has been made, running index processor ("
<< tmp << ") on file " << f);
@ -1510,4 +1525,42 @@ int LaTeX::scanBlgFile(DepTable & dep, TeXErrors & terr)
}
int LaTeX::scanIlgFile(TeXErrors & terr)
{
FileName const ilg_file(changeExtension(file.absFileName(), "ilg"));
LYXERR(Debug::LATEX, "Scanning ilg file: " << ilg_file);
ifstream ifs(ilg_file.toFilesystemEncoding().c_str());
string token;
int retval = NO_ERRORS;
string prevtoken;
while (getline(ifs, token)) {
token = rtrim(token, "\r");
smatch sub;
if (prefixIs(token, "!! "))
prevtoken = token;
else if (!prevtoken.empty()) {
retval |= INDEX_ERROR;
string errstr = N_("Makeindex error: ") + prevtoken;
string msg = prevtoken + '\n';
msg += token;
terr.insertError(0,
from_local8bit(errstr),
from_local8bit(msg));
prevtoken.clear();
} else if (prefixIs(token, "ERROR: ")) {
retval |= BIBTEX_ERROR;
string errstr = N_("Xindy error: ") + token.substr(6);
string msg = token;
terr.insertError(0,
from_local8bit(errstr),
from_local8bit(msg));
}
}
return retval;
}
} // namespace lyx

View File

@ -153,7 +153,9 @@ public:
///
NONZERO_ERROR = 32768, // the command exited with nonzero status
///
ERRORS = TEX_ERROR + LATEX_ERROR + NONZERO_ERROR + BIBTEX_ERROR,
INDEX_ERROR = 65536,
///
ERRORS = TEX_ERROR + LATEX_ERROR + NONZERO_ERROR + BIBTEX_ERROR + INDEX_ERROR,
///
WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING
};
@ -225,6 +227,9 @@ private:
///
int scanBlgFile(DepTable & head, TeXErrors & terr);
///
int scanIlgFile(TeXErrors & terr);
///
bool runBibTeX(std::vector<AuxInfo> const &,
OutputParams const &, int & exit_code);

View File

@ -47,9 +47,9 @@ namespace frontend {
// Information
QRegExp exprInfo("^(Document Class:|LaTeX Font Info:|File:|Package:|Language:|.*> INFO - |\\(|\\\\).*$");
// Warnings
QRegExp exprWarning("^(LaTeX Warning|LaTeX Font Warning|Package [\\w\\.]+ Warning|Class \\w+ Warning|Warning--|Underfull|Overfull|.*> WARN - ).*$");
QRegExp exprWarning("^(## Warning|LaTeX Warning|LaTeX Font Warning|Package [\\w\\.]+ Warning|Class \\w+ Warning|Warning--|Underfull|Overfull|.*> WARN - ).*$");
// Errors
QRegExp exprError("^(!|.*---line [0-9]+ of file|.*> FATAL - |.*> ERROR - |Missing character: There is no ).*$");
QRegExp exprError("^(ERROR: |!|.*---line [0-9]+ of file|.*> FATAL - |.*> ERROR - |Missing character: There is no ).*$");
/////////////////////////////////////////////////////////////////////