From ed17621baeb45319b311dda8072998d0f8b3fd45 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 18 May 2004 12:28:40 +0000 Subject: More adaptations to understand .SS macros. --- tools/index.tcl | 4 ++-- tools/man2html1.tcl | 2 +- tools/man2html2.tcl | 16 ++++++++++++---- tools/tcltk-man2html.tcl | 26 +++++++++++++++++--------- 4 files changed, 32 insertions(+), 16 deletions(-) diff --git a/tools/index.tcl b/tools/index.tcl index 26e4386..b39f7ca 100644 --- a/tools/index.tcl +++ b/tools/index.tcl @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: index.tcl,v 1.4 2003/06/04 23:40:18 mistachkin Exp $ +# RCS: @(#) $Id: index.tcl,v 1.5 2004/05/18 12:28:40 dkf Exp $ # # Global variables used by these scripts: @@ -133,7 +133,7 @@ proc text string { proc macro {name args} { switch $name { - SH { + SH - SS { global state switch $args { diff --git a/tools/man2html1.tcl b/tools/man2html1.tcl index 2e8ba52..0adc61e 100644 --- a/tools/man2html1.tcl +++ b/tools/man2html1.tcl @@ -75,7 +75,7 @@ proc text string { proc macro {name args} { switch $name { - SH { + SH - SS { global state switch $args { diff --git a/tools/man2html2.tcl b/tools/man2html2.tcl index 789b4db..41244eb 100644 --- a/tools/man2html2.tcl +++ b/tools/man2html2.tcl @@ -307,6 +307,9 @@ proc macro {name args} { SH { SHmacro $args } + SS { + SSmacro $args subsection + } SO { global noFillCount inPRE file @@ -625,12 +628,13 @@ proc macro2 {name args} { # SHmacro -- # -# Subsection head; handles the .SH macro. +# Subsection head; handles the .SH and .SS macros. # # Arguments: # name - Section name. +# style - Type of section (optional) -proc SHmacro argList { +proc SHmacro {argList {style section}} { global file noFillCount textState charCnt set args [join $argList " "] @@ -641,9 +645,13 @@ proc SHmacro argList { set noFillCount 0 nest reset - puts -nonewline $file "

" + set tag H3 + if {[string compare "subsection" $level] == 0} { + set tag H4 + } + puts -nonewline $file "<$tag>" text $args - puts $file "

" + puts $file "" # ? args textState diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl index b7d03dc..7190b1d 100755 --- a/tools/tcltk-man2html.tcl +++ b/tools/tcltk-man2html.tcl @@ -488,7 +488,7 @@ proc output-RS-list {} { .RE { break } - .SH { + .SH - .SS { manerror "unbalanced .RS at section end" backup-text 1 break @@ -534,7 +534,10 @@ proc output-IP-list {context code rest} { man-puts } else { # labelled list, make contents - if {[string compare $context ".SH"]} { + if { + [string compare $context ".SH"] && + [string compare $context ".SS"] + } then { man-puts

} man-puts

@@ -954,14 +957,18 @@ proc output-directive {line} { .BE { # man-puts
} - .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 "

[long-toc $manual(section)]

" + if {[string compare .SS $code]} { + man-puts "

[long-toc $manual(section)]

" + } else { + man-puts "

[long-toc $manual(section)]

" + } # 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 +1001,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 +1030,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 +1057,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 +1080,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 +1385,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]" -- cgit v0.12