diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/tcltk-man2html.tcl | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index 30e11d3..b9c8280 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -230,6 +230,7 @@ proc process-text {text} { {\(+-} {±} \ {\fP} {\fR} \ {\.} . \ + {\(bu} {•} \ ] $text] regsub -all {\\o'o\^'} $text {\ô} text; # o-circumflex in re_syntax.n regsub -all {\\-\\\|\\-} $text -- text; # two hyphens @@ -488,7 +489,7 @@ proc output-RS-list {} { .RE { break } - .SH { + .SH - .SS { manerror "unbalanced .RS at section end" backup-text 1 break @@ -534,7 +535,10 @@ proc output-IP-list {context code rest} { man-puts </DL> } else { # labelled list, make contents - if {[string compare $context ".SH"]} { + if { + [string compare $context ".SH"] && + [string compare $context ".SS"] + } then { man-puts <P> } man-puts <DL> @@ -555,6 +559,8 @@ proc output-IP-list {context code rest} { if {[string equal $manual(section) "ARGUMENTS"] || \ [regexp {^\[\d+\]$} $rest]} { man-puts "$para<DT>$rest<DD>" + } elseif {[string equal {•} $rest]} { + man-puts "$para<DT><DD>$rest " } else { man-puts "$para<DT>[long-toc $rest]<DD>" } @@ -954,14 +960,18 @@ proc output-directive {line} { .BE { # man-puts <HR> } - .SH { + .SH - .SS { # drain any open lists # announce the subject set manual(section) $rest # start our own stack of stuff set manual($manual(name)-$manual(section)) {} lappend manual(has-$manual(section)) $manual(name) - man-puts "<H3>[long-toc $manual(section)]</H3>" + if {[string compare .SS $code]} { + man-puts "<H3>[long-toc $manual(section)]</H3>" + } else { + man-puts "<H4>[long-toc $manual(section)]</H4>" + } # some sections can simply free wheel their way through the text # some sections can be processed in their own loops switch -exact $manual(section) { @@ -994,6 +1004,7 @@ proc output-directive {line} { continue } if {[next-op-is .SH rest] + || [next-op-is .SS rest] || [next-op-is .BE rest] || [next-op-is .SO rest]} { backup-text 1 @@ -1022,7 +1033,7 @@ proc output-directive {line} { } {SEE ALSO} { while {[more-text]} { - if {[next-op-is .SH rest]} { + if {[next-op-is .SH rest] || [next-op-is .SS rest]} { backup-text 1 return } @@ -1049,7 +1060,7 @@ proc output-directive {line} { } KEYWORDS { while {[more-text]} { - if {[next-op-is .SH rest]} { + if {[next-op-is .SH rest] || [next-op-is .SS rest]} { backup-text 1 return } @@ -1072,7 +1083,7 @@ proc output-directive {line} { } } if {[next-op-is .IP rest]} { - output-IP-list .SH .IP $rest + output-IP-list $code .IP $rest return } if {[next-op-is .PP rest]} { @@ -1377,11 +1388,11 @@ proc make-man-pages {html args} { set manual(partial-text) {} } switch -exact $code { - .SH { + .SH - .SS { if {[llength $rest] == 0} { gets $manual(infp) rest } - lappend manual(text) ".SH [unquote $rest]" + lappend manual(text) "$code [unquote $rest]" } .TH { lappend manual(text) "$code [unquote $rest]" @@ -1601,7 +1612,7 @@ proc make-man-pages {html args} { } puts $afp "</H2><HR><DL>" foreach k $keys { - if {[regexp -nocase -- "^keyword-$a" $k]} { + if {[string match -nocase "keyword-${a}*" $k]} { set k [string range $k 8 end] puts $afp "<DT><A NAME=\"$k\">$k</A><DD>" set refs {} |