summaryrefslogtreecommitdiff
path: root/Build/source/doc/splitinfo.gawk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-04-08 18:39:18 +0000
committerKarl Berry <karl@freefriends.org>2014-04-08 18:39:18 +0000
commitc7bc49d06e3d005eb2541be8c4e59e8e0b4ac08a (patch)
treed3510868da06e9074a8a0fc7f93805d828759227 /Build/source/doc/splitinfo.gawk
parentb50a5847011e3cc3058d2a43b5204ba04e289802 (diff)
general texlive.texi update for Texinfo, etc.
git-svn-id: svn://tug.org/texlive/trunk@33406 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/doc/splitinfo.gawk')
-rw-r--r--Build/source/doc/splitinfo.gawk44
1 files changed, 44 insertions, 0 deletions
diff --git a/Build/source/doc/splitinfo.gawk b/Build/source/doc/splitinfo.gawk
new file mode 100644
index 00000000000..dd1133fafb4
--- /dev/null
+++ b/Build/source/doc/splitinfo.gawk
@@ -0,0 +1,44 @@
+# $Id$
+# Public domain. Originally written 2014 by Karl Berry.
+# Split chapter 2 of plain text output from makeinfo,
+# making each section into a separate README file.
+
+BEGIN {
+ lastline = ""; # have to read one line ahead
+ outfile = ""; # where we are currently outputting
+}
+
+{
+ if (/^[*=]+$/) { # starting new chapter or section
+ # if we're at the index, quit.
+ if (lastline == "Index") exit (0);
+
+ # otherwise ignore unless chapter 2 (don't care about top, index, etc.)
+ if (lastline !~ /^2/) next;
+
+ # ok, we want this. if we had a file open already, close it.
+ if (outfile) close (outfile);
+
+ # turn section title into filename and start new.
+ outfile = tolower (lastline); # all lowercase
+ sub ("^2 ", "2.0 overview ", outfile); # consider beginning of chapter as 2.0
+ sub ("^2\\.", "", outfile); # remove "2."
+ sub (" ", "", outfile); # remove first space (after secnum)
+ sub (" .*", "", outfile); # remove space and everything after,
+ # leaving just the first word.
+ outfile = "README." outfile; # prefix "README.
+ #
+ print "(This file was generated by makeinfo and splitinfo.gawk.)">outfile;
+ print "(Released under the old-style GNU documentation license;" >outfile;
+ print " see sources or other output files for full text.)" >outfile;
+ print "" >outfile;
+ print lastline >outfile;
+ # $0 will be printed as lastline, next time through.
+
+ # splitting output.
+ } else if (outfile) {
+ print lastline >outfile;
+ }
+
+ lastline = $0;
+}