Do not break on undefined references that are part of the family.

Thus a document can be viewed if it contains references to
its master, children or siblings that are being excluded via includeonly,
or viewed standalone if it contains references to its master or siblings.
This commit is contained in:
Juergen Spitzmueller 2020-03-14 09:43:57 +01:00
parent 38a46b43c7
commit 02d2e4aa32
3 changed files with 23 additions and 6 deletions

View File

@ -875,7 +875,7 @@ Converters::RetVal Converters::runLaTeX(Buffer const & buffer, string const & co
if (result & LaTeX::ERRORS) if (result & LaTeX::ERRORS)
buffer.bufferErrors(terr, errorList); buffer.bufferErrors(terr, errorList);
if ((result & LaTeX::UNDEF_CIT) || (result & LaTeX::UNDEF_REF)) { if ((result & LaTeX::UNDEF_CIT) || (result & LaTeX::UNDEF_UNKNOWN_REF)) {
buffer.bufferRefs(terr, errorList); buffer.bufferRefs(terr, errorList);
if (errorList.empty()) if (errorList.empty())
errorList.push_back(ErrorItem(_("Undefined reference"), errorList.push_back(ErrorItem(_("Undefined reference"),
@ -913,7 +913,7 @@ Converters::RetVal Converters::runLaTeX(Buffer const & buffer, string const & co
LaTeX::NO_LOGFILE | LaTeX::NO_LOGFILE |
LaTeX::ERRORS | LaTeX::ERRORS |
LaTeX::UNDEF_CIT | LaTeX::UNDEF_CIT |
LaTeX::UNDEF_REF | LaTeX::UNDEF_UNKNOWN_REF |
LaTeX::NO_OUTPUT; LaTeX::NO_OUTPUT;
return (result & ERROR_MASK) == 0 ? SUCCESS : FAILURE; return (result & ERROR_MASK) == 0 ? SUCCESS : FAILURE;

View File

@ -795,6 +795,7 @@ int LaTeX::scanLogFile(TeXErrors & terr)
bool fle_style = false; bool fle_style = false;
static regex const file_line_error(".+\\.\\D+:[0-9]+: (.+)"); static regex const file_line_error(".+\\.\\D+:[0-9]+: (.+)");
static regex const child_file("[^0-9]*([0-9]+[A-Za-z]*_.+\\.tex).*"); static regex const child_file("[^0-9]*([0-9]+[A-Za-z]*_.+\\.tex).*");
static regex const undef_ref(".*Reference `(\\w+)\\' on page.*");
// Flag for 'File ended while scanning' message. // Flag for 'File ended while scanning' message.
// We need to wait for subsequent processing. // We need to wait for subsequent processing.
string wait_for_error; string wait_for_error;
@ -895,15 +896,29 @@ int LaTeX::scanLogFile(TeXErrors & terr)
} else if (contains(token, "Reference") } else if (contains(token, "Reference")
//&& contains(token, "on input line")) //often split to new line //&& contains(token, "on input line")) //often split to new line
&& contains(token, "undefined")) { && contains(token, "undefined")) {
if (regex_match(token, sub, undef_ref)) {
string const ref = sub.str(1);
Buffer const * buf = theBufferList().getBufferFromTmp(file.absFileName());
if (!buf || !buf->masterBuffer()->activeLabel(from_utf8(ref))) {
terr.insertRef(getLineNumber(token), from_ascii("Reference undefined"),
from_utf8(token), child_name);
retval |= UNDEF_UNKNOWN_REF;
}
}
retval |= UNDEF_REF; retval |= UNDEF_REF;
terr.insertRef(getLineNumber(token), from_ascii("Reference undefined"),
from_utf8(token), child_name);
//If label is too long pdlaftex log line splitting will make the above fail //If label is too long pdlaftex log line splitting will make the above fail
//so we catch at least this generic statement occuring for both CIT & REF. //so we catch at least this generic statement occuring for both CIT & REF.
} else if (!runparams.includeall && contains(token, "There were undefined references.")) { } else if (!runparams.includeall && contains(token, "There were undefined references.")) {
if (!(retval & UNDEF_CIT)) //if not handled already if (!(retval & UNDEF_CIT)) { //if not handled already
retval |= UNDEF_REF; if (regex_match(token, sub, undef_ref)) {
string const ref = sub.str(1);
Buffer const * buf = theBufferList().getBufferFromTmp(file.absFileName());
if (!buf || !buf->masterBuffer()->activeLabel(from_utf8(ref)))
retval |= UNDEF_UNKNOWN_REF;
}
retval |= UNDEF_REF;
}
} }
} else if (prefixIs(token, "Package")) { } else if (prefixIs(token, "Package")) {

View File

@ -155,6 +155,8 @@ public:
/// ///
INDEX_ERROR = 65536, INDEX_ERROR = 65536,
/// ///
UNDEF_UNKNOWN_REF = 131072,
///
ERRORS = TEX_ERROR + LATEX_ERROR + NONZERO_ERROR + BIBTEX_ERROR + INDEX_ERROR, ERRORS = TEX_ERROR + LATEX_ERROR + NONZERO_ERROR + BIBTEX_ERROR + INDEX_ERROR,
/// ///
WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING WARNINGS = TEX_WARNING + LATEX_WARNING + PACKAGE_WARNING