summaryrefslogtreecommitdiffstats
path: root/manual/latexfilter.pl
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-05-29 20:58:57 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-06-19 21:32:10 +0200
commitf8eb8c8679633d43e3c1e0d95feb2dab2d5cee8a (patch)
tree657adbd496f5d189d13be9fb3ae4fd9b60b7351e /manual/latexfilter.pl
parent3d0c787a48ff0d26fa5a1e93a4ca237df8999acf (diff)
downloadrockbox-f8eb8c8679633d43e3c1e0d95feb2dab2d5cee8a.tar.gz
rockbox-f8eb8c8679633d43e3c1e0d95feb2dab2d5cee8a.zip
Filter LaTeX output for errors.
Pipe the output of LaTeX through a Perl script and filter out information that is irrelevant in deciding if building the manual actually worked. Format errors in a similar way to gcc output to allow existing scripts catching it. Enabling verbose output during the make run will not remove parts of the output but only do some reflowing. The full log is always available in the manual subfolder. Change-Id: I15d35b4d3c73fafe2a4357168ca8ada51355f221 Reviewed-on: http://gerrit.rockbox.org/247 Reviewed-by: Dominik Riebeling <Dominik.Riebeling@gmail.com> Tested-by: Dominik Riebeling <Dominik.Riebeling@gmail.com>
Diffstat (limited to 'manual/latexfilter.pl')
-rwxr-xr-xmanual/latexfilter.pl62
1 files changed, 62 insertions, 0 deletions
diff --git a/manual/latexfilter.pl b/manual/latexfilter.pl
new file mode 100755
index 0000000000..45d7cedbdc
--- /dev/null
+++ b/manual/latexfilter.pl
@@ -0,0 +1,62 @@
+#!/usr/bin/perl -s
+#
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+#
+
+my $verbose = $v;
+my $reflowed = "";
+my $last = "";
+my $currentfile;
+while(<STDIN>) {
+ chomp $_;
+ $reflowed .= $_;
+ if(/^.{79,}$/) {
+ # collapse all "full" lines
+ }
+ elsif(/^!/) {
+ # collapse lines indicating an error with next one and append a space.
+ $reflowed .= " ";
+ }
+ else {
+ # skip empty lines
+ if(length($reflowed) > 0) {
+ # collapse with previous line if it continues some "area".
+ if($reflowed =~ /^\s*(\]|\[|\\|\)|<)/) {
+ $last .= $reflowed;
+ }
+ else {
+ # find current input file
+ my @inputfile = $last =~ /\(([a-zA-Z_\-\/\.]+\.tex)/g;
+ foreach(@inputfile) {
+ if($verbose) {
+ print "\n";
+ }
+ print "LaTeX processing $_\n";
+ $currentfile = $_;
+ }
+ if($verbose) {
+ print $last;
+ }
+ # check for error
+ if($reflowed =~ /^!\s*(.*)/) {
+ my $l = $reflowed;
+ $l =~ s/^!\s*(.*)l.(\d+) /$2: $1/;
+ print "$currentfile:$l\n";
+ }
+ # restart for next reflowed line
+ $last = $reflowed;
+ }
+ }
+ # restart reflowing.
+ $reflowed = "";
+ }
+}
+if($verbose) {
+ print $last;
+}
+