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])
19 gsub(/[^[:alnum:]_]+/, "", p[3])
20 append("index", tolower(p[3]), "xref:"p[3]"["p[2]"]:: "p[4])
22 append(p[1],"","[["p[3]"]]")
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]))
68 gsub(/[^[:alnum:]_]+/, "", p[4])
69 if (p[5]) append("index", tolower(p[4]), "xref:"p[4]"["p[3]"]:: "p[5])
70 append(p[1],"","[["p[4]"]]")
77 # Create an asciidoc index and anchor
78 # Sec Title Index Explanation
79 match($0, com"(.*) INDEX (.*); (.*); (.*)", p) {
82 gsub(/[^[:alnum:]_]+/, "", p[3])
83 append("index", tolower(p[3]), "xref:"p[3]"["p[2]"]:: "p[4])
85 append(p[1],"","[["p[3]"]]")