texlive[54406] trunk: texloganalyser (19mar20)

commits+karl at tug.org commits+karl at tug.org
Thu Mar 19 22:58:25 CET 2020


Revision: 54406
          http://tug.org/svn/texlive?view=revision&revision=54406
Author:   karl
Date:     2020-03-19 22:58:25 +0100 (Thu, 19 Mar 2020)
Log Message:
-----------
texloganalyser (19mar20)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/texloganalyser/texloganalyser
    trunk/Master/texmf-dist/doc/support/texloganalyser/README
    trunk/Master/texmf-dist/scripts/texloganalyser/texloganalyser

Modified: trunk/Build/source/texk/texlive/linked_scripts/texloganalyser/texloganalyser
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/texloganalyser/texloganalyser	2020-03-19 21:58:08 UTC (rev 54405)
+++ trunk/Build/source/texk/texlive/linked_scripts/texloganalyser/texloganalyser	2020-03-19 21:58:25 UTC (rev 54406)
@@ -1,6 +1,6 @@
 #!/usr/bin/env perl
 # This is texloganalyser, for parsing of TeX logs
-# Copyright (c) 2006-2014 Thomas van Oudenhove
+# Copyright (c) 2006-2020 Thomas van Oudenhove
 # All rights reserved
 
 # README - important notice:
@@ -38,8 +38,8 @@
 use Getopt::Long;
 Getopt::Long::Configure ("bundling");
 
-my $version = "0.9";
-my $copyright = "2006-2014";
+my $version = "0.10";
+my $copyright = "2006-2020";
 my $opt = {
     help => '',
     version => '',
@@ -49,6 +49,7 @@
     o => '',
     u => '',
     v => '',
+    c => '',
     p => '',
     f => '',
     w => '',
@@ -65,6 +66,7 @@
     'version' => \$opt->{version},
     'last' => \$opt->{last},
     'a' => \$opt->{a},
+    'c' => \$opt->{c},
     'h' => \$opt->{h},
     'o' => \$opt->{o},
     'u' => \$opt->{u},
@@ -105,8 +107,10 @@
 
 sub analyze {
     my $line;
+    my ($cbox, $chead);
     my $output;
     my $test = 0;
+    my $png = 0;
 
     open my $source, "<", $texlog;
     while (defined ($line = <$source>)) {
@@ -114,7 +118,9 @@
         # default: display summary
         summary($line);
         #          and page numbers ('n' option)
-        pagenumber($line) if $opt->{n};
+        my $pn = pagenumber($line);
+        print '['.$pn.']' if ($opt->{n} and $pn);
+        $png = $pn if $pn;
 
         if ($opt->{e}) {
             if ($line =~ m/Here is how much/) {
@@ -124,7 +130,19 @@
             $output .= $line if $test;
         }
         # look for boxes warnings
-        if ($opt->{o} and $opt->{h}) {
+        if ($opt->{c} and $opt->{o} and $opt->{h}) {
+            if ($line =~ m/\\hbox/ and $line =~ m/Overfull/) {
+                $line =~ m/^Overfull \\hbox \((\d+\.\d+)pt too wide\) (in paragraph|detected) at lines? ([0-9\-]+)$/;
+                $cbox->{$1} = 'Page '.$png.': '.$line;
+                $chead = 'Overfull hboxes classified:';
+            }
+        } elsif ($opt->{c} and $opt->{u} and $opt->{h}) {
+            if ($line =~ m/\\hbox/ and $line =~ m/Underfull/) {
+                $line =~ m/^Underfull \\hbox \(badness (\d+)\) (in paragraph|detected) at lines? ([0-9\-]+)$/;
+                $cbox->{$1} = 'Page '.$png.': '.$line;
+                $chead = 'Underfull hboxes classified:';
+            }
+        } elsif ($opt->{o} and $opt->{h}) {
             $output = $line if ($line =~ m/\\hbox/ and
                 $line =~ m/Overfull/);
         } elsif ($opt->{u} and $opt->{h}) {
@@ -195,6 +213,13 @@
         print "$output" if defined $output;
     }
     print "\n";
+    if ($opt->{c} and $opt->{h} and ($opt->{u} or $opt->{o})) {
+        print "$chead\n";
+        foreach my $key (sort {$a <=> $b} keys %{$cbox}) {
+            print $cbox->{$key};
+        }
+        print "\n";
+    }
     print_abstract();
     close $source;
 }
@@ -201,8 +226,8 @@
 
 sub pagenumber {
     my $logline = shift;
-    if ($logline =~ m/.*(\[[0-9]+)/) {
-        print $1."]";
+    if ($logline =~ m/.*\[([0-9]+)(\]|$)/) {
+        return $1;
     }
 }
 
@@ -244,26 +269,28 @@
 
 sub print_abstract {
     print "The log contained ".$abstract->{warnings}." warnings";
-    print " and $abstract->{badboxes} bad boxes" if $opt->{a}; 
-    print ".\n";    
+    print " and $abstract->{badboxes} bad boxes" if $opt->{a};
+    print ".\n";
 }
 
 sub printversion {
-    print "This is texloganalyser, version $version\n";
+    print "This is texloganalyser (Perl script), version $version\n";
     print "\t Copyright $copyright Thomas van Oudenhove\n";
+    print "\t License: BSD\n";
 }
 
 sub printhelp {
     printversion();
-    print "Usage: texloganalyser ".options()." <TeX log>\n";
+    print "\nUsage: texloganalyser ".options()." <TeX log>\n";
     print "\t Displays selective infos of LaTeX logs\n";
-    print "These flags may be used:\n";
+    print "\nThese flags may be used:\n";
     print "\t a: displays number of warnings about bad boxes\n";
+    print "\t c: displays the boxes warning by size (at the end)\n";
     print "\t e: displays the end of the log\n";
     print "\t f: outputs the LaTeX Font Infos\n";
     print "\t h: outputs only warnings about horizontal boxes\n";
     print "\t i: displays 'images' (pdf, [e]ps, png, jpg) used\n";
-    print "\t n: displays page numbers\n";    
+    print "\t n: displays page numbers\n";
     print "\t o: outputs only warnings about overfull boxes\n";
     print "\t p: outputs the LaTeX Packages infos\n";
     print "\t r: displays warnings about references\n";
@@ -271,8 +298,8 @@
     print "\t t: displays .tex files used\n";
     print "\t u: outputs only warnings about underfull boxes\n";
     print "\t v: outputs only warnings about vertical boxes\n";
-    print "\t w: displays all Warnings\n";
-    print "You may want to have a look at `perldoc texloganalyser`.\n";
+    print "\t w: displays all Warnings\n\n";
+    print "More documentation is available with `perldoc texloganalyser`.\n";
 }
 
 __END__
@@ -288,7 +315,7 @@
 
 =head2 SYNOPSIS
 
-texloganalyser [-aefhinoprstuvw] tex_log_file
+texloganalyser [-acefhinoprstuvw] tex_log_file
 
 texloganalyser [--version]
 
@@ -310,6 +337,8 @@
 
 =item B<-a>: counts number of badboxes.
 
+=item B<-c>: classify boxes warnings by size (needs h&o,u or v&o,u) at the end.
+
 =item B<-e>: displays the end of the log, about the TeX's memory.
 
 =item B<-f>: outputs the LaTeX Font Infos warnings and calculations.
@@ -350,10 +379,14 @@
 
 Akim Demaille submitted a patch for 'last' option, June 2012.
 
+Paulo Ney de Souza had the idea of -c option to better handle hboxes, March 2020.
+
 =head3 Changelog
 
 =over
 
+=item v0.10: added option -c, to classify boxes warnings by size (Paulo Ney de Souza's idea).
+
 =item v0.9: added option --last, if log file contains several compilations (Akim Demaille's patch).
 
 =item v0.8: added options for page and bad boxes number (Markus Hennig's patch).

Modified: trunk/Master/texmf-dist/doc/support/texloganalyser/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/texloganalyser/README	2020-03-19 21:58:08 UTC (rev 54405)
+++ trunk/Master/texmf-dist/doc/support/texloganalyser/README	2020-03-19 21:58:25 UTC (rev 54406)
@@ -1,8 +1,25 @@
-This is texloganalyser (Perl script), version 0.9
-	Copyright 2006-2014 Thomas van Oudenhove
-	License: BSD
+This is texloganalyser (Perl script), version 0.10
+	 Copyright 2006-2020 Thomas van Oudenhove
+	 License: BSD
 
-Usage: texloganalyser [--help|--version|-efhioprstuvw] <TeX log>
-	Displays selective infos of LaTeX logs
+Usage: texloganalyser [--help|--version|-acefhilastnoprstuvw] <TeX log>
+	 Displays selective infos of LaTeX logs
 
+These flags may be used:
+	 a: displays number of warnings about bad boxes
+	 c: displays the boxes warning by size (at the end)
+	 e: displays the end of the log
+	 f: outputs the LaTeX Font Infos
+	 h: outputs only warnings about horizontal boxes
+	 i: displays 'images' (pdf, [e]ps, png, jpg) used
+	 n: displays page numbers
+	 o: outputs only warnings about overfull boxes
+	 p: outputs the LaTeX Packages infos
+	 r: displays warnings about references
+	 s: displays .sty and .cls files used
+	 t: displays .tex files used
+	 u: outputs only warnings about underfull boxes
+	 v: outputs only warnings about vertical boxes
+	 w: displays all Warnings
+
 More documentation is available with `perldoc texloganalyser`.

Modified: trunk/Master/texmf-dist/scripts/texloganalyser/texloganalyser
===================================================================
--- trunk/Master/texmf-dist/scripts/texloganalyser/texloganalyser	2020-03-19 21:58:08 UTC (rev 54405)
+++ trunk/Master/texmf-dist/scripts/texloganalyser/texloganalyser	2020-03-19 21:58:25 UTC (rev 54406)
@@ -1,6 +1,6 @@
 #!/usr/bin/env perl
 # This is texloganalyser, for parsing of TeX logs
-# Copyright (c) 2006-2014 Thomas van Oudenhove
+# Copyright (c) 2006-2020 Thomas van Oudenhove
 # All rights reserved
 
 # README - important notice:
@@ -38,8 +38,8 @@
 use Getopt::Long;
 Getopt::Long::Configure ("bundling");
 
-my $version = "0.9";
-my $copyright = "2006-2014";
+my $version = "0.10";
+my $copyright = "2006-2020";
 my $opt = {
     help => '',
     version => '',
@@ -49,6 +49,7 @@
     o => '',
     u => '',
     v => '',
+    c => '',
     p => '',
     f => '',
     w => '',
@@ -65,6 +66,7 @@
     'version' => \$opt->{version},
     'last' => \$opt->{last},
     'a' => \$opt->{a},
+    'c' => \$opt->{c},
     'h' => \$opt->{h},
     'o' => \$opt->{o},
     'u' => \$opt->{u},
@@ -105,8 +107,10 @@
 
 sub analyze {
     my $line;
+    my ($cbox, $chead);
     my $output;
     my $test = 0;
+    my $png = 0;
 
     open my $source, "<", $texlog;
     while (defined ($line = <$source>)) {
@@ -114,7 +118,9 @@
         # default: display summary
         summary($line);
         #          and page numbers ('n' option)
-        pagenumber($line) if $opt->{n};
+        my $pn = pagenumber($line);
+        print '['.$pn.']' if ($opt->{n} and $pn);
+        $png = $pn if $pn;
 
         if ($opt->{e}) {
             if ($line =~ m/Here is how much/) {
@@ -124,7 +130,19 @@
             $output .= $line if $test;
         }
         # look for boxes warnings
-        if ($opt->{o} and $opt->{h}) {
+        if ($opt->{c} and $opt->{o} and $opt->{h}) {
+            if ($line =~ m/\\hbox/ and $line =~ m/Overfull/) {
+                $line =~ m/^Overfull \\hbox \((\d+\.\d+)pt too wide\) (in paragraph|detected) at lines? ([0-9\-]+)$/;
+                $cbox->{$1} = 'Page '.$png.': '.$line;
+                $chead = 'Overfull hboxes classified:';
+            }
+        } elsif ($opt->{c} and $opt->{u} and $opt->{h}) {
+            if ($line =~ m/\\hbox/ and $line =~ m/Underfull/) {
+                $line =~ m/^Underfull \\hbox \(badness (\d+)\) (in paragraph|detected) at lines? ([0-9\-]+)$/;
+                $cbox->{$1} = 'Page '.$png.': '.$line;
+                $chead = 'Underfull hboxes classified:';
+            }
+        } elsif ($opt->{o} and $opt->{h}) {
             $output = $line if ($line =~ m/\\hbox/ and
                 $line =~ m/Overfull/);
         } elsif ($opt->{u} and $opt->{h}) {
@@ -195,6 +213,13 @@
         print "$output" if defined $output;
     }
     print "\n";
+    if ($opt->{c} and $opt->{h} and ($opt->{u} or $opt->{o})) {
+        print "$chead\n";
+        foreach my $key (sort {$a <=> $b} keys %{$cbox}) {
+            print $cbox->{$key};
+        }
+        print "\n";
+    }
     print_abstract();
     close $source;
 }
@@ -201,8 +226,8 @@
 
 sub pagenumber {
     my $logline = shift;
-    if ($logline =~ m/.*(\[[0-9]+)/) {
-        print $1."]";
+    if ($logline =~ m/.*\[([0-9]+)(\]|$)/) {
+        return $1;
     }
 }
 
@@ -244,26 +269,28 @@
 
 sub print_abstract {
     print "The log contained ".$abstract->{warnings}." warnings";
-    print " and $abstract->{badboxes} bad boxes" if $opt->{a}; 
-    print ".\n";    
+    print " and $abstract->{badboxes} bad boxes" if $opt->{a};
+    print ".\n";
 }
 
 sub printversion {
-    print "This is texloganalyser, version $version\n";
+    print "This is texloganalyser (Perl script), version $version\n";
     print "\t Copyright $copyright Thomas van Oudenhove\n";
+    print "\t License: BSD\n";
 }
 
 sub printhelp {
     printversion();
-    print "Usage: texloganalyser ".options()." <TeX log>\n";
+    print "\nUsage: texloganalyser ".options()." <TeX log>\n";
     print "\t Displays selective infos of LaTeX logs\n";
-    print "These flags may be used:\n";
+    print "\nThese flags may be used:\n";
     print "\t a: displays number of warnings about bad boxes\n";
+    print "\t c: displays the boxes warning by size (at the end)\n";
     print "\t e: displays the end of the log\n";
     print "\t f: outputs the LaTeX Font Infos\n";
     print "\t h: outputs only warnings about horizontal boxes\n";
     print "\t i: displays 'images' (pdf, [e]ps, png, jpg) used\n";
-    print "\t n: displays page numbers\n";    
+    print "\t n: displays page numbers\n";
     print "\t o: outputs only warnings about overfull boxes\n";
     print "\t p: outputs the LaTeX Packages infos\n";
     print "\t r: displays warnings about references\n";
@@ -271,8 +298,8 @@
     print "\t t: displays .tex files used\n";
     print "\t u: outputs only warnings about underfull boxes\n";
     print "\t v: outputs only warnings about vertical boxes\n";
-    print "\t w: displays all Warnings\n";
-    print "You may want to have a look at `perldoc texloganalyser`.\n";
+    print "\t w: displays all Warnings\n\n";
+    print "More documentation is available with `perldoc texloganalyser`.\n";
 }
 
 __END__
@@ -288,7 +315,7 @@
 
 =head2 SYNOPSIS
 
-texloganalyser [-aefhinoprstuvw] tex_log_file
+texloganalyser [-acefhinoprstuvw] tex_log_file
 
 texloganalyser [--version]
 
@@ -310,6 +337,8 @@
 
 =item B<-a>: counts number of badboxes.
 
+=item B<-c>: classify boxes warnings by size (needs h&o,u or v&o,u) at the end.
+
 =item B<-e>: displays the end of the log, about the TeX's memory.
 
 =item B<-f>: outputs the LaTeX Font Infos warnings and calculations.
@@ -350,10 +379,14 @@
 
 Akim Demaille submitted a patch for 'last' option, June 2012.
 
+Paulo Ney de Souza had the idea of -c option to better handle hboxes, March 2020.
+
 =head3 Changelog
 
 =over
 
+=item v0.10: added option -c, to classify boxes warnings by size (Paulo Ney de Souza's idea).
+
 =item v0.9: added option --last, if log file contains several compilations (Akim Demaille's patch).
 
 =item v0.8: added options for page and bad boxes number (Markus Hennig's patch).



More information about the tex-live-commits mailing list.