projects
/
c-standard
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix annot (recognise _ as first char in section title)
[c-standard]
/
ann2html.sh
diff --git
a/ann2html.sh
b/ann2html.sh
index
500e36a
..
5a93b35
100755
(executable)
--- a/
ann2html.sh
+++ b/
ann2html.sh
@@
-8,12
+8,16
@@
BEGIN {
ss[sid] = "<pre>"
}
ss[sid] = "<pre>"
}
-{
+
function esc()
{
gsub(/\&/, "\\&")
gsub(/</, "\\<")
gsub(/>/, "\\>")
}
gsub(/\&/, "\\&")
gsub(/</, "\\<")
gsub(/>/, "\\>")
}
+{
+ esc()
+}
+
!title && /^[^@]/ {
title = $0
gsub(/ +/, " ", title)
!title && /^[^@]/ {
title = $0
gsub(/ +/, " ", title)
@@
-35,6
+39,7
@@
seencontents && !seenfore && /^[^@]/ {
s = $0
if (!sub(/ +\. .*/, "", s)) {
getline
s = $0
if (!sub(/ +\. .*/, "", s)) {
getline
+ esc()
sub(/^ */, " ")
s = s $0
sub(/ +\. .*/, "", s)
sub(/^ */, " ")
s = s $0
sub(/ +\. .*/, "", s)
@@
-78,6
+83,7
@@
seencontents && !seenfore && /^[^@]/ {
}
sid++
getline
}
sid++
getline
+ esc()
ss[sid] = ss[sid] "<h1>" $0 "</h1>\n"
if (!seencontents) {
ss[sid] = ss[sid] "<pre>\n"
ss[sid] = ss[sid] "<h1>" $0 "</h1>\n"
if (!seencontents) {
ss[sid] = ss[sid] "<pre>\n"
@@
-96,6
+102,7
@@
seencontents && !seenfore && /^[^@]/ {
slevel = 5
sect = $2
getline
slevel = 5
sect = $2
getline
+ esc()
# todo hX, back to top
ss[sid] = sprintf("<h%s><a name=\"%s\" href=\"#%s\">%s</a></h%s>\n", slevel, sect, sect, $0, slevel)
if ($0 == "Index")
# todo hX, back to top
ss[sid] = sprintf("<h%s><a name=\"%s\" href=\"#%s\">%s</a></h%s>\n", slevel, sect, sect, $0, slevel)
if ($0 == "Index")
@@
-133,7
+140,7
@@
seencontents && !seenfore && /^[^@]/ {
/^@end pre/ {
if (!pre)
next
/^@end pre/ {
if (!pre)
next
- pre = pre "</pre>\n"
+ pre = pre "
\n
</pre>\n"
if (nn)
note[nn] = note[nn] "\n" pre
else
if (nn)
note[nn] = note[nn] "\n" pre
else
@@
-162,7
+169,7
@@
seencontents && !seenfore && /^[^@]/ {
}
/^ ?(Syntax|Semantics|Description|Constraints|Synopsis|Returns|Recommended practice|Implementation limits|Environmental limits)$/ {
}
/^ ?(Syntax|Semantics|Description|Constraints|Synopsis|Returns|Recommended practice|Implementation limits|Environmental limits)$/ {
- ss[sid] = ss[sid] "<
h6>" $0 "</h6
>\n"
+ ss[sid] = ss[sid] "<
p><b>" $0 "</b
>\n"
next
}
next
}
@@
-211,6
+218,11
@@
seencontents && !seenfore && /^[^@]/ {
}
s = p s
p = ""
}
s = p s
p = ""
+ # 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)
for (;;) {
while (match(s, noteid-1 "\\)")) {
p = p substr(s,1,RSTART-1)
@@
-250,12
+262,13
@@
END {
print ss[i]
n = split(snote[i],a)
if (n > 0) {
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"
}
print s
}
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"
}
print s
}
+ print "<p><small><a href=\"#Contents\">Contents</a></small>"
}
print "</body></html>"
}
print "</body></html>"