include source file and line number comments by asciidoc.pawk
authorChristian Thaeter <ct@pipapo.org>
Sat, 29 Aug 2009 21:02:59 +0000 (23:02 +0200)
committerChristian Thaeter <ct@pipapo.org>
Fri, 4 Sep 2009 04:32:03 +0000 (06:32 +0200)
doc/asciidoc.pawk

index 71bafb1..02c4839 100644 (file)
@@ -1,4 +1,13 @@
 
+# include asciidoc comments about filename and linenumber in generated document
+match($0, com "([[:alpha:]][[:alnum:]_]*)(([.]([^[:space:]]*)))?", p) {
+    if(p[1] != old_index)
+    {
+        old_index = p[1]
+        append(p[1], p[4], "// "FILENAME ":" FNR " //")
+    }
+}
+
 # Create an asciidoc paragraph and index entry
 #             Sec       Name  Index Explanation
 match($0, com"(.*) PARA (.*); *(.*); *(.*)", p) {
@@ -23,3 +32,4 @@ match($0, com"(.*) HEAD(.) (.*); *(.*); *(.*)", p) {
     append(p[1],"",gensub(/./, p[2], "g", p[3]))
     next
 }
+