[latexila] Latex pp: more detailed warning message



commit dc21c2c6857c26543f652ebdb476cc29e1d9d976
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Sat Jul 30 00:07:15 2011 +0200

    Latex pp: more detailed warning message
    
    Here is an example of a 'latex' or 'pdflatex' warning output:
    
    Package Fancyhdr Warning: \headheight is too small (12.0pt):
     Make it at least 13.59999pt.
     We now make it that large for the rest of the document.
     This may cause the page layout to be inconsistent, however.
    
    Before this commit, the result was:
    
    \headheight is too small (12.0pt): Make it at least 13.59999pt.
    
    An important missing information is the name of the package. So now the
    result is:
    
    Fancyhdr: \headheight is too small (12.0pt): Make it at least
    13.59999pt.

 src/latex_post_processor.vala |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/src/latex_post_processor.vala b/src/latex_post_processor.vala
index f257cbb..210f0d8 100644
--- a/src/latex_post_processor.vala
+++ b/src/latex_post_processor.vala
@@ -107,9 +107,11 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
             reg_badbox_output =
                 new Regex ("(.*)has occurred while \\output is active");
 
-            reg_warning = new Regex (
-                "^(((! )?(La|pdf)TeX)|Package|Class) .*Warning[^:]*:\\s*(.*)",
-                RegexCompileFlags.CASELESS);
+            string warning_str = "^(((! )?(La|pdf)TeX)|Package|Class)";
+            warning_str += "(?P<name>.*) Warning[^:]*:\\s*(?P<contents>.*)";
+            reg_warning = new Regex (warning_str,
+                RegexCompileFlags.CASELESS | RegexCompileFlags.OPTIMIZE);
+
             reg_warning_no_file = new Regex ("(No file .*)");
             reg_warning_line = new Regex ("(.*) on input line (\\d+)\\.$");
             reg_warning_international_line = new Regex ("(.*)(\\d+)\\.$");
@@ -296,17 +298,22 @@ private class LatexPostProcessor : GLib.Object, PostProcessor
         switch (status)
         {
             case FilterStatus.START:
-                if (reg_warning.match (line))
+                MatchInfo match_info;
+                if (reg_warning.match (line, 0, out match_info))
                 {
                     msg.message_type = BuildMessageType.WARNING;
 
-                    string[] strings = reg_warning.split (line);
+                    string contents = match_info.fetch_named ("contents");
+
+                    string name = match_info.fetch_named ("name").strip ();
+                    if (name != "")
+                        contents = @"$name: $contents";
 
-                    if (detect_warning_line (strings[5], false))
+                    if (detect_warning_line (contents, false))
                         add_msg ();
                     else
                     {
-                        line_buf = strings[5];
+                        line_buf = contents;
                         nb_lines++;
                     }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]