X-Git-Url: http://nsz.repo.hu/git/?p=c-standard;a=blobdiff_plain;f=ann2html.sh;h=a4c127c5fddf3f0baa128a81387c1fd225ec589e;hp=ad4413dbca7ac3bb04bf163f311af389b3337b4a;hb=6fa09ff7f9eb20582513c80f0fa883b056bde241;hpb=e2222fbac46edfdcd3e3f7de33d8e515e58bc369 diff --git a/ann2html.sh b/ann2html.sh index ad4413d..a4c127c 100755 --- a/ann2html.sh +++ b/ann2html.sh @@ -85,6 +85,10 @@ seencontents && !seenfore && /^[^@]/ { next } +/^@sect 3\./ { + markdef = 1 +} + /^@sect/ { sid++ slevel = split($2,a,/\./)+1 @@ -129,7 +133,7 @@ seencontents && !seenfore && /^[^@]/ { /^@end pre/ { if (!pre) next - pre = pre "\n" + pre = pre "\n\n" if (nn) note[nn] = note[nn] "\n" pre else @@ -157,8 +161,8 @@ seencontents && !seenfore && /^[^@]/ { next } -/^ *(Syntax|Semantics|Description|Constraints|Synopsis|Returns)$/ { - ss[sid] = ss[sid] "
" $0 "
\n" +/^ ?(Syntax|Semantics|Description|Constraints|Synopsis|Returns|Recommended practice|Implementation limits|Environmental limits)$/ { + ss[sid] = ss[sid] "

" $0 "\n" next } @@ -207,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) "opt" substr(s,RSTART+RLENGTH-1) + if (match(s, /[a-z]opt$/)) + s = substr(s,1,RSTART) "opt" + for (;;) { + while (match(s, noteid-1 "\\)")) { + p = p substr(s,1,RSTART-1) + p = p "" noteid-1 ")" + s = substr(s,RSTART+RLENGTH) + } + if (!match(s, noteid "\\)")) + break if (noteid==1 && s !~ /\.1\)/) break p = p substr(s,1,RSTART-1) @@ -218,6 +234,10 @@ seencontents && !seenfore && /^[^@]/ { } s = p s sub(/^ *Forward references/, "

&", s) + if (markdef) { + s = "" s "
" + markdef = 0 + } if (pre) pre = pre "\n" s else if (nn) @@ -235,7 +255,7 @@ END { print ss[i] n = split(snote[i],a) if (n > 0) { - s = "

footnotes
\n" + s = "

Footnotes\n" for (j = 1; j <= n; j++) { s = s "

" a[j] ")" note[a[j]+0] "\n" }