summaryrefslogtreecommitdiff
path: root/lib/sbin/FixPageNumbersInPostscript.pl
diff options
context:
space:
mode:
authortradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-03-15 13:01:14 +0000
committertradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-03-15 13:01:14 +0000
commit148b8934435d9725049884a4b4e73e9cf2390559 (patch)
tree1e9191c1630fa622e9a8cd2073c565f08f911972 /lib/sbin/FixPageNumbersInPostscript.pl
parentc31cc156d1b686fc17f74d08cdd35e4e0faa133d (diff)
Fix page numbers in postfiles for UsersGuide, MaintGuide, and ThornGuide.
This closes PR Documentation/514,623,624,848. git-svn-id: http://svn.cactuscode.org/flesh/trunk@2644 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/FixPageNumbersInPostscript.pl')
-rwxr-xr-xlib/sbin/FixPageNumbersInPostscript.pl44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/sbin/FixPageNumbersInPostscript.pl b/lib/sbin/FixPageNumbersInPostscript.pl
new file mode 100755
index 00000000..f8253eaa
--- /dev/null
+++ b/lib/sbin/FixPageNumbersInPostscript.pl
@@ -0,0 +1,44 @@
+#!/usr/bin/perl -w
+#/*@@
+# @routine FixPageNumbersInPostscript.pl
+# @date Fri 15 Mar 2002
+# @author Thomas Radke
+# @desc
+# Fixes the line numbers in the postscript versions of the
+# Cactus UsersGuide, ThornGuide, and MaintGuide
+# @enddesc
+# @version $Header$
+#@@*/
+
+# $part counts the parts (chapters) in the postscript file
+$part = 0;
+
+# @part_letters lists the numbering for all the parts
+# the first two parts (title page and table of contents) are skipped
+@part_letters = ('', '', 'A' .. 'Z');
+
+# $last_line must match EOP in order to check for a new page
+$last_line = "eop\n";
+
+
+# skip all lines in the postscript setup and prolog
+while (<>)
+{
+ print;
+ last if (/^%%EndProlog\n$/);
+}
+
+
+while (<>)
+{
+ if ($last_line =~ /eop$/ && /^%%Page: (\d+) (\d+)$/)
+ {
+ $part++ if ($1 == 1);
+ $_ = "%%Page: ${part_letters[$part]}$1 $2\n";
+ }
+
+ print;
+ $last_line = $_;
+}
+
+1;