projects
/
c-standard
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix empty lines around pages, change arrow and sqrt translit
[c-standard]
/
tohtml.sh
diff --git
a/tohtml.sh
b/tohtml.sh
index
1eee1d2
..
8555d24
100755
(executable)
--- a/
tohtml.sh
+++ b/
tohtml.sh
@@
-39,6
+39,7
@@
BEGIN {
} else
print
}
} else
print
}
+ note = 1
}
!seenindex && /^ *([1-9A-Z]\.|Annex|Index|Foreword|Introduction|Bibliography)/ {
}
!seenindex && /^ *([1-9A-Z]\.|Annex|Index|Foreword|Introduction|Bibliography)/ {
@@
-46,7
+47,8
@@
BEGIN {
if (id ~ /Annex/)
id = $2
if (($0 ~ /^ [1-9]\./ || id ~ /^([A-Z]|[1-9A-Z]\.[1-9][0-9.]*|Index|Foreword|Introduction|Bibliography)$/) &&
if (id ~ /Annex/)
id = $2
if (($0 ~ /^ [1-9]\./ || id ~ /^([A-Z]|[1-9A-Z]\.[1-9][0-9.]*|Index|Foreword|Introduction|Bibliography)$/) &&
- (NF==1 || $2 ~ /^[A-Z]/)) {
+ (NF==1 || $2 ~ /^[A-Z]/) &&
+ ($0 !~ /^ *[0-9.]+[^0-9]$/)) {
if (id ~ /\.$/)
id = substr(id,1,length(id)-1)
print "<a name=\"" id "\" href=\"#" id "\"><b>" $0 "</b></a>"
if (id ~ /\.$/)
id = substr(id,1,length(id)-1)
print "<a name=\"" id "\" href=\"#" id "\"><b>" $0 "</b></a>"
@@
-58,7
+60,12
@@
BEGIN {
/^\[page / {
p = substr($2,1,length($2)-1)
/^\[page / {
p = substr($2,1,length($2)-1)
- print "[<a name=\"#p" p "\" href=\"p" p "\">page " p "</a>] (<a href=\"#Contents\">Contents</a>)"
+ print "[<a name=\"p" p "\" href=\"#p" p "\">page " p "</a>] (<a href=\"#Contents\">Contents</a>)"
+ next
+}
+
+/^ *(Syntax|Semantics|Description|Constraints|Synopsis|Returns)$/ {
+ print "<b>" $0 "</b>"
next
}
next
}
@@
-71,23
+78,48
@@
BEGIN {
r = "[ (][A-Z1-9]\\.[0-9.]*[0-9]"
while (match(s, r)) {
p = p substr(s,1,RSTART)
r = "[ (][A-Z1-9]\\.[0-9.]*[0-9]"
while (match(s, r)) {
p = p substr(s,1,RSTART)
-
l
= substr(s,RSTART+1,RLENGTH-1)
- if (
l ~ /[4-9][0-9]/ || l ~ /[0-3][0-9][0-9]/ || substr(s,RSTART+RLENGTH,1) ~ /[a-zA-Z
]/)
- p = p
l
+
m
= substr(s,RSTART+1,RLENGTH-1)
+ if (
m ~ /\.0$/ || m ~ /[4-9][0-9]/ || m ~ /[0-3][0-9][0-9]/ || substr(s,RSTART+RLENGTH,1) ~ /[a-zA-Z\-
]/)
+ p = p
m
else
else
- p = p "<a href=\"#" l "\">" l "</a>"
+ p = p "<a href=\"#" m "\">" m "</a>"
+ s = substr(s,RSTART+RLENGTH)
+ }
+ s = p s
+ p = ""
+ while (match(s, /[Aa]nnex [A-Z]/)) {
+ p = p substr(s,1,RSTART-1)
+ m = substr(s,RSTART,RLENGTH)
+ p = p "<a href=\"#" substr(m,RLENGTH,1) "\">" m "</a>"
s = substr(s,RSTART+RLENGTH)
}
s = p s
p = ""
while (match(s, /<[a-zA-Z0-9_]*\.h>/)) {
p = p substr(s,1,RSTART-1)
s = substr(s,RSTART+RLENGTH)
}
s = p s
p = ""
while (match(s, /<[a-zA-Z0-9_]*\.h>/)) {
p = p substr(s,1,RSTART-1)
-
h
= substr(s,RSTART,RLENGTH)
- if (
h
in header)
- p = p "<a href=\"#" header[
h] "\">" h
"</a>"
+
m
= substr(s,RSTART,RLENGTH)
+ if (
m
in header)
+ p = p "<a href=\"#" header[
m] "\">" m
"</a>"
else
else
- p = p h
+ p = p m
+ s = substr(s,RSTART+RLENGTH)
+ }
+ s = p s
+ p = ""
+ while (match(s, note "\\)")) {
+ if (note==1 && s !~ /\.1\)/)
+ break
+ p = p substr(s,1,RSTART-1)
+ p = p "<sup><a href=\"#note" note "\"><b>" note ")</b></a></sup>"
+ note++
s = substr(s,RSTART+RLENGTH)
}
s = substr(s,RSTART+RLENGTH)
}
- print p s
-}'
+ s = p s
+ if (s ~ /^ *[1-9][0-9]*\) /) {
+ sub(/\)/,"",s)
+ sub(/[0-9]+/,"<sup><a name=\"note&\" href=\"#note&\"><b>&)</b></a></sup>",s)
+ }
+ print s
+}
+
+END { print "</pre></body></html>" }'