diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-07-06 09:27:31 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-07-06 09:27:31 (GMT) |
commit | 9bab74701d98f139b8d5d9042f5695a6eb5c6c2c (patch) | |
tree | 7c3d61b3105e86ade815a6ee352e44b38a2685a3 /tools/man2html2.tcl | |
parent | aee6cb4cd5dbcb6810c743b830184b84384efb59 (diff) | |
download | tcl-9bab74701d98f139b8d5d9042f5695a6eb5c6c2c.zip tcl-9bab74701d98f139b8d5d9042f5695a6eb5c6c2c.tar.gz tcl-9bab74701d98f139b8d5d9042f5695a6eb5c6c2c.tar.bz2 |
More elegant fix for tab size handling
Diffstat (limited to 'tools/man2html2.tcl')
-rw-r--r-- | tools/man2html2.tcl | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/tools/man2html2.tcl b/tools/man2html2.tcl index 399b54c..3e1344e 100644 --- a/tools/man2html2.tcl +++ b/tools/man2html2.tcl @@ -5,7 +5,7 @@ # # Copyright (c) 1996 by Sun Microsystems, Inc. # -# $Id: man2html2.tcl,v 1.5 2004/07/06 09:25:48 dkf Exp $ +# $Id: man2html2.tcl,v 1.6 2004/07/06 09:27:31 dkf Exp $ # # Global variables used by these scripts: @@ -519,27 +519,26 @@ proc setTabs {tabList} { 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}] - } - i { - set distance [expr {$distance * $charsPerInch}] + if {[regexp {^\\w'(.*)'u$} $arg content]} { + set distance [string length $content] + } else { + if {[scan $arg "%f%s" distance units] != 2} { + puts stderr "bad distance \"$arg\"" + return 0 } - default { - puts stderr "bad units in distance \"$arg\"" - continue + switch -- $units { + c { + set distance [expr {$distance * $charsPerInch / 2.54}] + } + i { + set distance [expr {$distance * $charsPerInch}] + } + default { + puts stderr "bad units in distance \"$arg\"" + continue + } } - } + } # ? distance if {$relative} { append tabString [format "%*s1" [expr {round($distance-1)}] " "] |