X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=tohtml.sh;h=b764269e71b3c3302688f101851028e3080e38c2;hb=d1af4fc376749aa3bb0386727923e975680be227;hp=1eee1d298a9187278e04aaaaaeaa9a12fdf24394;hpb=17cf8804ce9a599dd8c41bf83515a2068ccc01f3;p=c-standard
diff --git a/tohtml.sh b/tohtml.sh
index 1eee1d2..b764269 100755
--- a/tohtml.sh
+++ b/tohtml.sh
@@ -46,7 +46,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)$/) &&
- (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 "" $0 ""
@@ -58,7 +59,7 @@ BEGIN {
/^\[page / {
p = substr($2,1,length($2)-1)
- print "[page " p "] (Contents)"
+ print "[page " p "] (Contents)"
next
}
@@ -71,23 +72,33 @@ BEGIN {
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
- p = p "" l ""
+ p = p "" m ""
+ 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 "" m ""
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 "" h ""
+ m = substr(s,RSTART,RLENGTH)
+ if (m in header)
+ p = p "" m ""
else
- p = p h
+ p = p m
s = substr(s,RSTART+RLENGTH)
}
print p s
-}'
+}
+
+END { print "