fix index/anchor generation, anchors must be after the target header
authorChristian Thaeter <ct@pipapo.org>
Mon, 16 Aug 2010 19:46:16 +0000 (21:46 +0200)
committerChristian Thaeter <ct@pipapo.org>
Mon, 16 Aug 2010 19:46:16 +0000 (21:46 +0200)
doc/asciidoc.pawk

index fe072c9..07ee99c 100644 (file)
@@ -11,6 +11,7 @@ match($0, com "([[:alpha:]][[:alnum:]_]*)(([.]([^[:space:]]*)))?", p) {
 # Create an asciidoc paragraph and index entry
 #             Sec       Name  Index Explanation
 match($0, com"(.*) PARA (.*); *(.*); *(.*)", p) {
+    append(p[1],"","."p[2])
     if(p[3])
     {
         if (p[4])
@@ -20,7 +21,6 @@ match($0, com"(.*) PARA (.*); *(.*); *(.*)", p) {
         }
         append(p[1],"","[["p[3]"]]")
     }
-    append(p[1],"","."p[2])
     next
 }
 
@@ -61,14 +61,14 @@ match($0, com"(.*) HEAD([^ ]+) (.*); *(.*); *(.*)", p) {
 
     if (p[3])
     {
+        append(p[1],"",p[3])
+        append(p[1],"",gensub(/./, p[2], "g", p[3]))
         if (p[4])
         {
             gsub(/[^[:alnum:]_]+/, "__", p[4])
             if (p[5]) append("index", tolower(p[4]), "xref:"p[4]"["p[3]"]:: "p[5])
             append(p[1],"","[["p[4]"]]")
         }
-        append(p[1],"",p[3])
-        append(p[1],"",gensub(/./, p[2], "g", p[3]))
     }
     next
 }