diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-10-26 14:32:15 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-10-26 14:32:15 (GMT) |
commit | d2b63746183fe9a91992b7327fcc262fef67f088 (patch) | |
tree | 7d4e9a884720c15da35cf61e39bdd49d32bf2794 /tools/man2help2.tcl | |
parent | d3af9b6c8c71010caf7b39bc82653ab9db34d055 (diff) | |
download | tcl-d2b63746183fe9a91992b7327fcc262fef67f088.zip tcl-d2b63746183fe9a91992b7327fcc262fef67f088.tar.gz tcl-d2b63746183fe9a91992b7327fcc262fef67f088.tar.bz2 |
Working towards better nroff scraping...
Diffstat (limited to 'tools/man2help2.tcl')
-rw-r--r-- | tools/man2help2.tcl | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/tools/man2help2.tcl b/tools/man2help2.tcl index 62b5b2e..7cd020c 100644 --- a/tools/man2help2.tcl +++ b/tools/man2help2.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: man2help2.tcl,v 1.15 2004/07/07 12:08:43 dkf Exp $ +# RCS: @(#) $Id: man2help2.tcl,v 1.16 2007/10/26 14:32:16 dkf Exp $ # # Global variables used by these scripts: @@ -425,6 +425,21 @@ proc macro {name args} { } VE {} VS {} + QW { + formattedText "``[lindex $args 0]''[lindex $args 1] " + } + MT { + text "``'' " + } + PQ { + formattedText \ + "(``[lindex $args 0]''[lindex $args 1])[lindex $args 2] " + } + QR { + formattedText "``[lindex $args 0]" + dash + formattedText "[lindex $args 1]''[lindex $args 2] " + } default { puts stderr "Unknown macro: .$name [join $args " "]" } @@ -516,13 +531,12 @@ proc formattedText {text} { dash set text [string range $text [expr {$index+2}] end] } - | { + & - | { set text [string range $text [expr {$index+2}] end] } - o { - text "\\'" - regexp {'([^']*)'(.*)} $text all ch text - text $chars($ch) + ( { + char [string range $text $index [expr {$index+3}]] + set text [string range $text [expr {$index+4}] end] } default { puts stderr "Unknown sequence: \\$c" @@ -665,32 +679,51 @@ proc char {name} { global file state switch -exact $name { - \\o { + {\o} { set state(intl) 1 } - \\\ { + {\ } { textSetup puts -nonewline $file " " } - \\0 { + {\0} { textSetup puts -nonewline $file " \\emspace " } - \\\\ { + {\\} - {\e} { textSetup puts -nonewline $file "\\\\" } - \\(+- { + {\(+-} { textSetup puts -nonewline $file "\\'b1 " } - \\% - - \\| { + {\%} - {\|} { } - \\(bu { + {\(->} { + textSetup + puts -nonewline $file "->" + } + {\(bu} { textSetup puts -nonewline $file "\\bullet " } + {\(co} { + textSetup + puts -nonewline $file "\\'a9 " + } + {\(mu} { + textSetup + puts -nonewline $file "\\'d7 " + } + {\(em} { + textSetup + puts -nonewline $file "-" + } + {\(fm} { + textSetup + puts -nonewline $file "\\'27 " + } default { puts stderr "Unknown character: $name" } |