2 # include asciidoc comments about filename and linenumber in generated document
3 match($0, com "([[:alpha:]][[:alnum:]_]*)(([.]([^[:space:]]*)))?", p) {
7 append(p[1], p[4], "// "FILENAME ":" FNR " //")
11 # Create an asciidoc paragraph and index entry
12 # Sec Name Index Explanation
13 match($0, com"(.*) PARA (.*); *(.*); *(.*)", p) {
16 if (p[4]) append("index", tolower(p[3]), "xref:"p[3]"["p[2]"]:: "p[4])
17 append(p[1],"","[["p[3]"]]")
19 append(p[1],"","."p[2])
24 asciidoc_header[0]="="
25 asciidoc_header[1]="-"
26 asciidoc_header[2]="~"
27 asciidoc_header[3]="^"
28 asciidoc_header[4]="+"
33 # Create an asciidoc headline and index entry
34 # Sec Typ Name Index Explanation
35 match($0, com"(.*) HEAD([^ ]+) (.*); *(.*); *(.*)", p) {
37 p[2] = asciidoc_header[asciidoc_level]
38 else if (p[2] == "++")
40 if (asciidoc_level < 4) ++asciidoc_level
41 p[2] = asciidoc_header[asciidoc_level]
43 else if (p[2] == "--")
45 if (asciidoc_level > 1) --asciidoc_level
46 p[2] = asciidoc_header[asciidoc_level]
50 for (n_HEAD = 0; n_HEAD <=4; ++n_HEAD) {
51 if (p[2] == asciidoc_header[n_HEAD]) {
52 asciidoc_level = n_HEAD
62 if (p[5]) append("index", tolower(p[4]), "xref:"p[4]"["p[3]"]:: "p[5])
63 append(p[1],"","[["p[4]"]]")
66 append(p[1],"",gensub(/./, p[2], "g", p[3]))
72 # Create an asciidoc index and anchor
73 # Sec Title Index Explanation
74 match($0, com"(.*) INDEX (.*); (.*); (.*)", p) {
75 if (p[4]) append("index", tolower(p[3]), "xref:"p[3]"["p[2]"]:: "p[4])
76 append(p[1],"","[["p[3]"]]")