summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/classpack/decommentbbl.awk
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-03-05 23:31:39 +0000
committerKarl Berry <karl@freefriends.org>2014-03-05 23:31:39 +0000
commite05f4b2815d04baad31f361e219c65b863cf76bc (patch)
treefe1186a0a8ba218f27fb5e39db73675322ab34b7 /Master/texmf-dist/doc/support/classpack/decommentbbl.awk
parent78421b8cf188c4dab7c54d40b422386364441fcd (diff)
classpack (requested by dbitouze, 5mar14)
git-svn-id: svn://tug.org/texlive/trunk@33101 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/classpack/decommentbbl.awk')
-rw-r--r--Master/texmf-dist/doc/support/classpack/decommentbbl.awk37
1 files changed, 37 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/support/classpack/decommentbbl.awk b/Master/texmf-dist/doc/support/classpack/decommentbbl.awk
new file mode 100644
index 00000000000..0ceb4d7f369
--- /dev/null
+++ b/Master/texmf-dist/doc/support/classpack/decommentbbl.awk
@@ -0,0 +1,37 @@
+# decommentbbl.awk
+#
+# This awk(1) script catenates consecutive lines of a BiBTeX-produced
+# .bbl file which end in a comment character (removing the comment
+# character in the process) because the default % comment character
+# gets misinterpreted by the ltxdoc package when building class or
+# package files.
+#
+# Copyright © 2008-2012 Silmaril Consultants
+# Available under the terms of the LaTeX Project Public License
+# as part of the classpack development package
+# Peter Flynn <peter@silmaril.ie> 2010-10-14
+#
+######################################################################
+#
+# Read every line of the file into an array
+
+{
+ line[NR]=$0;
+}
+
+######################################################################
+#
+# At the end, go through the array; if a line ends with a % sign,
+# catenate it to the buffer, omitting the percent sign itself;
+# otherwise, output the buffer and zero it for further use.
+
+END {
+ for(i=1;i<=NR;++i) {
+ if(substr(line[i],length(line[i]))=="%") {
+ buffer=buffer substr(line[i],1,length(line[i])-1);
+ } else {
+ print buffer line[i];buffer="";
+ }
+ }
+}
+