include source file and line number comments by asciidoc.pawk
[nobug.git] / doc / asciidoc.pawk
blob02c48399b2391b59966c404c35c4c1542c4dd97f
2 # include asciidoc comments about filename and linenumber in generated document
3 match($0, com "([[:alpha:]][[:alnum:]_]*)(([.]([^[:space:]]*)))?", p) {
4     if(p[1] != old_index)
5     {
6         old_index = p[1]
7         append(p[1], p[4], "// "FILENAME ":" FNR " //")
8     }
11 # Create an asciidoc paragraph and index entry
12 #             Sec       Name  Index Explanation
13 match($0, com"(.*) PARA (.*); *(.*); *(.*)", p) {
14     if(p[3])
15     {
16         append("index", tolower(p[3]), "xref:"p[3]"["p[2]"]:: "p[4])
17         append(p[1],"","[["p[3]"]]")
18     }
19     append(p[1],"","."p[2])
20     next
23 # Create an asciidoc headline and index entry
24 #             Sec      Typ Name  Index Explanation
25 match($0, com"(.*) HEAD(.) (.*); *(.*); *(.*)", p) {
26     if (p[4])
27     {
28         append("index", tolower(p[4]), "xref:"p[4]"["p[3]"]:: "p[5])
29         append(p[1],"","[["p[4]"]]")
30     }
31     append(p[1],"",p[3])
32     append(p[1],"",gensub(/./, p[2], "g", p[3]))
33     next