summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--tools/man2html2.tcl52
2 files changed, 40 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 848f22a..82796c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-06 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * tools/man2html2.tcl (IPmacro, setTabs): Added support for the
+ more advanced *roff macros used in Tk's doc/bind.n
+
2004-07-05 Miguel Sofer <msofer@users.sf.net>
* generic/tclBasic.c (DeleteInterpProc): fix for [Bug 983660],
diff --git a/tools/man2html2.tcl b/tools/man2html2.tcl
index 41244eb..d802d7d 100644
--- a/tools/man2html2.tcl
+++ b/tools/man2html2.tcl
@@ -5,7 +5,7 @@
#
# Copyright (c) 1996 by Sun Microsystems, Inc.
#
-# SCCS: @(#) man2html2.tcl 1.2 96/03/21 10:48:30
+# $Id: man2html2.tcl,v 1.4 2004/07/06 09:21:30 dkf Exp $
#
# Global variables used by these scripts:
@@ -506,34 +506,50 @@ proc tab {} {
proc setTabs {tabList} {
global file breakPending tabString
-# puts "setTabs: --$tabList--"
+ # puts "setTabs: --$tabList--"
set last 0
set tabString {}
set charsPerInch 14.
set numTabs [llength $tabList]
foreach arg $tabList {
+ if {[string match +* $arg]} {
+ set relative 1
+ set arg [string range $arg 1 end]
+ } else {
+ set relative 0
+ }
+ # Always operate in relative mode for "measurement" mode
+ if {[regexp {^\\w'.*'u$} $arg]} {
+ append tabString " 1"
+ set last [expr {$last + 2}]
+ continue
+ }
if {[scan $arg "%f%s" distance units] != 2} {
puts stderr "bad distance \"$arg\""
return 0
}
switch -- $units {
c {
- set distance [expr $distance * $charsPerInch / 2.54 ]
+ set distance [expr {$distance * $charsPerInch / 2.54}]
}
i {
- set distance [expr $distance * $charsPerInch]
+ set distance [expr {$distance * $charsPerInch}]
}
default {
puts stderr "bad units in distance \"$arg\""
continue
}
}
-# ? distance
- lappend tabString [format "%*s1" [expr round($distance-$last-1)] " "]
- set last $distance
+ # ? distance
+ if {$relative} {
+ append tabString [format "%*s1" [expr {round($distance-1)}] " "]
+ set last [expr {$last + $distance}]
+ } else {
+ append tabString [format "%*s1" [expr {round($distance-$last-1)}] " "]
+ set last $distance
+ }
}
- set tabString [join $tabString {}]
-# puts "setTabs: --$tabString--"
+ # puts "setTabs: --$tabString--"
}
@@ -696,15 +712,20 @@ proc IPmacro argList {
nest para UL LI
return
}
+ # Special case for alternative mechanism for declaring bullets
+ if {[lindex $argList 0] eq "\\(bu"} {
+ nest para UL LI
+ return
+ }
if {$length == 1} {
nest para OL LI
- return
- }
+ return
+ }
if {$length > 1} {
nest para DL DT
- formattedText [lindex $argList 0]
- puts $file "\n<DD>"
- return
+ formattedText [lindex $argList 0]
+ puts $file "\n<DD>"
+ return
}
puts stderr "Bad .IP macro: .IP [join $argList " "]"
}
@@ -874,6 +895,3 @@ proc do fileName {
puts $file "</BODY></HTML>"
close $file
}
-
-
-