4 sed 's/&/\&/g;s/</\</g;s/>/\>/g' |
awk '
7 print "<html><head><title>" $0 "</title></head><body><pre>"
10 while (getline == 1) {
15 print "<a name=\"Contents\" href=\"#Contents\">Contents</a>"
17 while (getline == 1) {
21 if (id ~ /^([1-9A-Z]|Index|Foreword|Introduction|Bibliography)/) {
22 if (match($0, /<[a-zA-Z0-9_]*\.h>/)) {
23 h=substr($0,RSTART,RLENGTH)
28 id = substr(id,1,length(id)-1)
29 s = "<a href=\"#" id "\">" $0
44 !seenindex && /^ *([1-9A-Z]\.|Annex|Index|Foreword|Introduction|Bibliography)/ {
48 if (($0 ~ /^ [1-9]\./ || id ~ /^([A-Z]|[1-9A-Z]\.[1-9][0-9.]*|Index|Foreword|Introduction|Bibliography)$/) &&
49 (NF==1 || $2 ~ /^[A-Z]/)) {
51 id = substr(id,1,length(id)-1)
52 print "<a name=\"" id "\" href=\"#" id "\"><b>" $0 "</b></a>"
60 p = substr($2,1,length($2)-1)
61 print "[<a name=\"#p" p "\" href=\"p" p "\">page " p "</a>] (<a href=\"#Contents\">Contents</a>)"
69 r = "[ (][A-Z1-9][0-9.]*"
71 r = "[ (][A-Z1-9]\\.[0-9.]*[0-9]"
73 p = p substr(s,1,RSTART)
74 l = substr(s,RSTART+1,RLENGTH-1)
75 if (l ~ /[4-9][0-9]/ || l ~ /[0-3][0-9][0-9]/ || substr(s,RSTART+RLENGTH,1) ~ /[a-zA-Z]/)
78 p = p "<a href=\"#" l "\">" l "</a>"
79 s = substr(s,RSTART+RLENGTH)
83 while (match(s, /<[a-zA-Z0-9_]*\.h>/)) {
84 p = p substr(s,1,RSTART-1)
85 h = substr(s,RSTART,RLENGTH)
87 p = p "<a href=\"#" header[h] "\">" h "</a>"
90 s = substr(s,RSTART+RLENGTH)