X-Git-Url: http://nsz.repo.hu/git/?p=c-standard;a=blobdiff_plain;f=tohtml.sh;h=6531b6023362a663a4aab2844bd67a4af1f7d768;hp=b764269e71b3c3302688f101851028e3080e38c2;hb=daefbb6400ba0f6e6bede9647587060d280c9235;hpb=d1af4fc376749aa3bb0386727923e975680be227 diff --git a/tohtml.sh b/tohtml.sh index b764269..6531b60 100755 --- a/tohtml.sh +++ b/tohtml.sh @@ -1,104 +1,3 @@ #!/bin/sh -export LC_ALL=C -sed 's/&/\&/g;s//\>/g' | awk ' -BEGIN { - getline - print "" $0 "
"
-	print
-
-	while (getline == 1) {
-		if ($0 ~ /^Contents/)
-			break
-		print
-	}
-	print "Contents"
-
-	while (getline == 1) {
-		id = $1
-		if (id ~ /Annex/)
-			id = $2
-		if (id ~ /^([1-9A-Z]|Index|Foreword|Introduction|Bibliography)/) {
-			if (match($0, /<[a-zA-Z0-9_]*\.h>/)) {
-				h=substr($0,RSTART,RLENGTH)
-				if (!(h in header))
-					header[h] = id
-			}
-			if (id ~ /\.$/)
-				id = substr(id,1,length(id)-1)
-			s = "" $0
-			if ($(NF-1) == ".")
-				print s ""
-			else{
-				print s
-				getline
-				print $0 ""
-			}
-			if (id == "Index")
-				break
-		} else
-			print
-	}
-}
-
-!seenindex && /^ *([1-9A-Z]\.|Annex|Index|Foreword|Introduction|Bibliography)/ {
-	id = $1
-	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]/) &&
-	    ($0 !~ /^ *[0-9.]+[^0-9]$/)) {
-		if (id ~ /\.$/)
-			id = substr(id,1,length(id)-1)
-		print "" $0 ""
-		if (id == "Index")
-			seenindex=1
-		next
-	}
-}
-
-/^\[page / {
-	p = substr($2,1,length($2)-1)
-	print "[page " p "] (Contents)"
-	next
-}
-
-{
-	s = $0
-	p = ""
-	if (seenindex)
-		r = "[ (][A-Z1-9][0-9.]*"
-	else
-		r = "[ (][A-Z1-9]\\.[0-9.]*[0-9]"
-	while (match(s, r)) {
-		p = p substr(s,1,RSTART)
-		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 "" 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)
-		m = substr(s,RSTART,RLENGTH)
-		if (m in header)
-			p = p "" m ""
-		else
-			p = p m
-		s = substr(s,RSTART+RLENGTH)
-	}
-	print p s
-}
-
-END { print "
" }' +./annot.sh | ./ann2html.sh