commit 01e11f1853ae044ef6a22d2ceb74c02ca9697caf
Author: Juergen Spitzmueller <[email protected]>
Date: Sat Jul 25 17:25:29 2026 +0200
Track whether a latex rerun is needed with minted.
Alas, minted does not output a proper log message, so we need to
check for existing *.minted files
(cherry picked from commit 5caf79a0973dd3353067b1245ed9a7a3fad1f07a)
---
src/LaTeX.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/LaTeX.cpp b/src/LaTeX.cpp
index 9cfa599f6e..68c85598b9 100644
--- a/src/LaTeX.cpp
+++ b/src/LaTeX.cpp
@@ -1034,6 +1034,8 @@ int LaTeX::scanLogFile(TeXErrors & terr)
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 undef_ref(".*Reference `(.+)\\' on page.*");
+ static regex const
minted_data("\\\\openout[0-9]+.*=.*`(.+)(..).*data\\.minted'\\.");
+ static regex const minted_highlight("\\(\\./.*highlight\\.minted");
// Flag for 'File ended while scanning' message.
// We need to wait for subsequent processing.
string wait_for_error;
@@ -1046,6 +1048,8 @@ int LaTeX::scanLogFile(TeXErrors & terr)
string token;
string ml_token;
+ bool have_minted_data = false;
+ bool have_minted_highlight = false;
while (getline(ifs, token)) {
// MikTeX sometimes inserts \0 in the log file. They can't be
// removed directly with the existing string utility
@@ -1219,13 +1223,16 @@ int LaTeX::scanLogFile(TeXErrors & terr)
LYXERR(Debug::OUTFILE, "We should rerun.");
retval |= RERUN;
}
+ } else if (regex_match(token, sub, minted_data)) {
+ have_minted_data = true;
} else if (token[0] == '(') {
if (contains(token, "Rerun LaTeX") ||
contains(token, "Rerun to get")) {
// Used by natbib
LYXERR(Debug::OUTFILE, "We should rerun.");
retval |= RERUN;
- }
+ } else if (regex_match(token, sub, minted_highlight))
+ have_minted_highlight = true;
} else if (prefixIs(token, "! ")
|| (fle_style
&& regex_match(token, sub, file_line_error)
@@ -1427,6 +1434,10 @@ int LaTeX::scanLogFile(TeXErrors & terr)
}
}
}
+ // If we found a *data.minted but no *highlight.minted file
+ // we need another run to get proper minted output
+ if (have_minted_data && !have_minted_highlight)
+ retval |= RERUN;
LYXERR(Debug::OUTFILE, "Log line: " << token);
return retval;
}
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs