cosmetic change (h6 is small on modern browsers)
[c-standard] / ann2html.sh
index ecb0411..a4c127c 100755 (executable)
@@ -133,7 +133,7 @@ seencontents && !seenfore && /^[^@]/ {
 /^@end pre/ {
        if (!pre)
                next
-       pre = pre "</pre>\n"
+       pre = pre "\n</pre>\n"
        if (nn)
                note[nn] = note[nn] "\n" pre
        else
@@ -161,8 +161,8 @@ seencontents && !seenfore && /^[^@]/ {
        next
 }
 
-/^ *(Syntax|Semantics|Description|Constraints|Synopsis|Returns|Recommended practice|Implementation limits)$/ {
-       ss[sid] = ss[sid] "<h6>" $0 "</h6>\n"
+/^ ?(Syntax|Semantics|Description|Constraints|Synopsis|Returns|Recommended practice|Implementation limits|Environmental limits)$/ {
+       ss[sid] = ss[sid] "<p><b>" $0 "</b>\n"
        next
 }
 
@@ -211,7 +211,19 @@ seencontents && !seenfore && /^[^@]/ {
        }
        s = p s
        p = ""
-       while (match(s, noteid "\\)")) {
+       # TODO: false positives..
+       while (match(s, /[a-z]opt[ )"]/))
+               s = substr(s,1,RSTART) "<sub>opt</sub>" substr(s,RSTART+RLENGTH-1)
+       if (match(s, /[a-z]opt$/))
+               s = substr(s,1,RSTART) "<sub>opt</sub>"
+       for (;;) {
+               while (match(s, noteid-1 "\\)")) {
+                       p = p substr(s,1,RSTART-1)
+                       p = p "<sup><a href=\"#note" noteid-1 "\"><b>" noteid-1 ")</b></a></sup>"
+                       s = substr(s,RSTART+RLENGTH)
+               }
+               if (!match(s, noteid "\\)"))
+                       break
                if (noteid==1 && s !~ /\.1\)/)
                        break
                p = p substr(s,1,RSTART-1)
@@ -243,7 +255,7 @@ END {
                print ss[i]
                n = split(snote[i],a)
                if (n > 0) {
-                       s = "<h6>footnotes</h6>\n"
+                       s = "<p><b>Footnotes</b>\n"
                        for (j = 1; j <= n; j++) {
                                s = s "<p><small><a name=\"note" a[j] "\" href=\"#note" a[j] "\">" a[j] ")</a>" note[a[j]+0] "</small>\n"
                        }