next
}
+BEGIN {
+ asciidoc_header[0]="="
+ asciidoc_header[1]="-"
+ asciidoc_header[2]="~"
+ asciidoc_header[3]="^"
+ asciidoc_header[4]="+"
+ asciidoc_level=1
+}
+
+
# Create an asciidoc headline and index entry
# Sec Typ Name Index Explanation
-match($0, com"(.*) HEAD(.) (.*); *(.*); *(.*)", p) {
+match($0, com"(.*) HEAD([^ ]+) (.*); *(.*); *(.*)", p) {
+ if (p[2] == "==")
+ p[2] = asciidoc_header[asciidoc_level]
+ else if (p[2] == "++")
+ {
+ if (asciidoc_level < 4) ++asciidoc_level
+ p[2] = asciidoc_header[asciidoc_level]
+ }
+ else if (p[2] == "--")
+ {
+ if (asciidoc_level > 1) --asciidoc_level
+ p[2] = asciidoc_header[asciidoc_level]
+ }
+
if (p[4])
{
append("index", tolower(p[4]), "xref:"p[4]"["p[3]"]:: "p[5])