summaryrefslogtreecommitdiffstats
path: root/ast/doincludes
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2018-01-09 19:06:55 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2018-01-09 19:06:55 (GMT)
commit01e0ebfe59d9028b0246ec4a549bd7528ada94eb (patch)
treea6c5b54db03177a1c8f3e7fb531990dfbc7bae39 /ast/doincludes
parentd64cf9c0bd23e752867b149be636d1bbd4501cf4 (diff)
downloadblt-01e0ebfe59d9028b0246ec4a549bd7528ada94eb.zip
blt-01e0ebfe59d9028b0246ec4a549bd7528ada94eb.tar.gz
blt-01e0ebfe59d9028b0246ec4a549bd7528ada94eb.tar.bz2
update ast 8.6.2
Diffstat (limited to 'ast/doincludes')
-rwxr-xr-xast/doincludes22
1 files changed, 22 insertions, 0 deletions
diff --git a/ast/doincludes b/ast/doincludes
new file mode 100755
index 0000000..656b0ac
--- /dev/null
+++ b/ast/doincludes
@@ -0,0 +1,22 @@
+#! /usr/bin/env perl
+
+# Reads a Latex file which contains \include{file} commands and writes
+# the document to standard output with the text of the included files
+# inserted.
+
+# Read input lines.
+ while ( <> ) {
+
+# Spot the \include{file} lines and extract the file name.
+ if ( ( $file ) = /^ *\\include{(.*)} *$/ ) {
+
+# Read the contents of the included file.
+ open( INCLUDE, $file . ".tex" );
+ while ( <INCLUDE> ) { print; }
+ close( INCLUDE );
+
+# Output other lines unchanged.
+ } else {
+ print;
+ }
+ }