[latexila] PostProcessorLatexmk: fix bug with latex output seen as latexmk output
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] PostProcessorLatexmk: fix bug with latex output seen as latexmk output
- Date: Wed, 16 Aug 2017 13:04:48 +0000 (UTC)
commit 947007e15347b536345bdf605169b4229c1ad7b0
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Aug 16 14:52:10 2017 +0200
PostProcessorLatexmk: fix bug with latex output seen as latexmk output
The bug was that warnings and badboxes were not detected when running
latexmk.
When running latexmk, I have this output (on Fedora 26, latexmk version
4.52c):
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex -synctex=1 -recorder "sample-build_tools.tex"'
------------
=== TeX engine is 'pdfTeX'
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
[...]
For the first line of the command output,
sub_command_output_matches_start_latexmk_message() doesn't match. It is
matched by the second line, but the second line also matches:
g_str_has_prefix (line, "Latexmk:"), so the state was set to
STATE_LATEXMK_MESSAGES.
src/liblatexila/latexila-post-processor-latexmk.c | 37 +++++++++++++-------
1 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/src/liblatexila/latexila-post-processor-latexmk.c
b/src/liblatexila/latexila-post-processor-latexmk.c
index 23357b7..e1d24c1 100644
--- a/src/liblatexila/latexila-post-processor-latexmk.c
+++ b/src/liblatexila/latexila-post-processor-latexmk.c
@@ -359,19 +359,15 @@ fetch_latexmk_messages (LatexilaPostProcessorLatexmk *pp,
add_sub_message (pp, msg);
}
-static void
-fetch_sub_command_output (LatexilaPostProcessorLatexmk *pp,
- gchar *line)
+static gboolean
+sub_command_output_matches_start_latexmk_message (const gchar *line)
{
static GRegex *regex_for_rule = NULL;
- static GRegex *regex_rule = NULL;
- GError *error = NULL;
-
- g_assert (pp->priv->state == STATE_SUB_COMMAND_OUTPUT_START ||
- pp->priv->state == STATE_SUB_COMMAND_OUTPUT_IN);
if (G_UNLIKELY (regex_for_rule == NULL))
{
+ GError *error = NULL;
+
regex_for_rule = g_regex_new ("^For rule '.*', running",
G_REGEX_OPTIMIZE,
0,
@@ -381,12 +377,27 @@ fetch_sub_command_output (LatexilaPostProcessorLatexmk *pp,
{
g_warning ("PostProcessorLatexmk: %s", error->message);
g_error_free (error);
- return;
+ return FALSE;
}
}
+ return (g_str_has_prefix (line, "Latexmk: applying rule") ||
+ g_regex_match (regex_for_rule, line, 0, NULL));
+}
+
+static void
+fetch_sub_command_output (LatexilaPostProcessorLatexmk *pp,
+ gchar *line)
+{
+ static GRegex *regex_rule = NULL;
+
+ g_assert (pp->priv->state == STATE_SUB_COMMAND_OUTPUT_START ||
+ pp->priv->state == STATE_SUB_COMMAND_OUTPUT_IN);
+
if (G_UNLIKELY (regex_rule == NULL))
{
+ GError *error = NULL;
+
regex_rule = g_regex_new ("^Rule '.*':",
G_REGEX_OPTIMIZE,
0,
@@ -402,15 +413,15 @@ fetch_sub_command_output (LatexilaPostProcessorLatexmk *pp,
if (pp->priv->state == STATE_SUB_COMMAND_OUTPUT_START)
{
- if (g_str_has_prefix (line, "Latexmk: applying rule") ||
- g_regex_match (regex_for_rule, line, 0, NULL))
+ if (sub_command_output_matches_start_latexmk_message (line))
goto end;
pp->priv->state = STATE_SUB_COMMAND_OUTPUT_IN;
}
- if (g_str_has_prefix (line, "Latexmk:") ||
- g_regex_match (regex_rule, line, 0, NULL))
+ if (!sub_command_output_matches_start_latexmk_message (line) &&
+ (g_str_has_prefix (line, "Latexmk:") ||
+ g_regex_match (regex_rule, line, 0, NULL)))
{
LatexilaBuildMsg *msg;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]