From 9bab74701d98f139b8d5d9042f5695a6eb5c6c2c Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 6 Jul 2004 09:27:31 +0000 Subject: More elegant fix for tab size handling --- tools/man2html2.tcl | 39 +++++++++++++++++++-------------------- 1 file 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)}] " "] -- cgit v0.12