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) {
14 append(p[1],"","."p[2])
17 id=gensub(/[^[:alnum:]]+/, "", "g", p[3])
20 append("index", tolower(p[3]), "xref:"id"["p[2]"]:: "p[4])
22 append(p[1],"","anchor:"id"[]")
28 asciidoc_header[0]="="
29 asciidoc_header[1]="-"
30 asciidoc_header[2]="~"
31 asciidoc_header[3]="^"
32 asciidoc_header[4]="+"
37 # Create an asciidoc headline and index entry
38 # Sec Typ Name Index Explanation
39 match($0, com"(.*) HEAD([^ ]+) (.*); *(.*); *(.*)", p) {
41 p[2] = asciidoc_header[asciidoc_level]
42 else if (p[2] == "++")
44 if (asciidoc_level < 4) ++asciidoc_level
45 p[2] = asciidoc_header[asciidoc_level]
47 else if (p[2] == "--")
49 if (asciidoc_level > 1) --asciidoc_level
50 p[2] = asciidoc_header[asciidoc_level]
54 for (n_HEAD = 0; n_HEAD <=4; ++n_HEAD) {
55 if (p[2] == asciidoc_header[n_HEAD]) {
56 asciidoc_level = n_HEAD
65 append(p[1],"",gensub(/./, p[2], "g", p[3]))
69 id=gensub(/[^[:alnum:]]+/, "", "g", p[4])
70 if (p[5]) append("index", tolower(p[4]), "xref:"id"["p[3]"]:: "p[5])
71 append(p[1],"","anchor:"id"[]")
78 # Create an asciidoc index and anchor
79 # Sec Title Index Explanation
80 match($0, com"(.*) INDEX (.*); (.*); (.*)", p) {
83 id=gensub(/[^[:alnum:]]+/, "", "g", p[3])
84 append("index", tolower(p[3]), "xref:"id"["p[2]"]:: "p[4])
86 append(p[1],"","anchor:"id"[]")