diff options
| author | kjnash <k.j.nash@usa.net> | 2022-08-31 16:19:00 (GMT) |
|---|---|---|
| committer | kjnash <k.j.nash@usa.net> | 2022-08-31 16:19:00 (GMT) |
| commit | bca70ca3acaed162e49bc7616b7da4001c7fee41 (patch) | |
| tree | e7f53f796bd576d7231fed8db0aa533ae65f59b6 /tools/tcltk-man2html-utils.tcl | |
| parent | 7e2bd5e5052a3fa8f5ee01c05e56fadf4cdfc592 (diff) | |
| parent | 6cf74d1492b68e11b5a4cccf559ec5f69836b67b (diff) | |
| download | tcl-bca70ca3acaed162e49bc7616b7da4001c7fee41.zip tcl-bca70ca3acaed162e49bc7616b7da4001c7fee41.tar.gz tcl-bca70ca3acaed162e49bc7616b7da4001c7fee41.tar.bz2 | |
Merge 8.7
Diffstat (limited to 'tools/tcltk-man2html-utils.tcl')
| -rw-r--r-- | tools/tcltk-man2html-utils.tcl | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl index b7a8520..78aa8ec 100644 --- a/tools/tcltk-man2html-utils.tcl +++ b/tools/tcltk-man2html-utils.tcl @@ -3,8 +3,8 @@ ## functions are specifically intended to work with the format as used ## by Tcl and Tk; they do not cope with arbitrary nroff markup. ## -## Copyright (c) 1995-1997 Roger E. Critchlow Jr -## Copyright (c) 2004-2011 Donal K. Fellows +## Copyright © 1995-1997 Roger E. Critchlow Jr +## Copyright © 2004-2011 Donal K. Fellows set ::manual(report-level) 1 @@ -889,7 +889,9 @@ proc insert-cross-references {text} { } switch -exact -- $invert([lindex $offsets 1]) { end-quote { - append result [string range $text 0 [expr {$offset(quote)-1}]] + if {$offset(quote) > 0} { + append result [string range $text 0 [expr {$offset(quote)-1}]] + } set body [string range $text [expr {$offset(quote)+2}] \ [expr {$offset(end-quote)-1}]] set text [string range $text[set text ""] \ @@ -916,8 +918,10 @@ proc insert-cross-references {text} { } switch -exact -- $invert([lindex $offsets 1]) { url - end-bold { - append result \ - [string range $text 0 [expr {$offset(bold)-1}]] + if {$offset(bold) > 0} { + append result \ + [string range $text 0 [expr {$offset(bold)-1}]] + } set body [string range $text [expr {$offset(bold)+3}] \ [expr {$offset(end-bold)-1}]] set text [string range $text[set text ""] \ @@ -939,8 +943,10 @@ proc insert-cross-references {text} { } } c.tk - c.ttk - c.tcl - c.tdbc - c.itcl { - append result [string range $text 0 \ - [expr {[lindex $offsets 0]-1}]] + if {[lindex $offsets 0] > 0} { + append result [string range $text 0 \ + [expr {[lindex $offsets 0]-1}]] + } regexp -indices -start [lindex $offsets 0] {\w+} $text range set body [string range $text {*}$range] set text [string range $text[set text ""] \ @@ -950,14 +956,18 @@ proc insert-cross-references {text} { } Tcl1 - Tcl2 { set off [lindex $offsets 0] - append result [string range $text 0 [expr {$off-1}]] + if {$off > 0} { + append result [string range $text 0 [expr {$off-1}]] + } set text [string range $text[set text ""] [expr {$off+3}] end] append result [cross-reference Tcl] continue } url { set off [lindex $offsets 0] - append result [string range $text 0 [expr {$off-1}]] + if {$off > 0} { + append result [string range $text 0 [expr {$off-1}]] + } regexp -indices -start $off {http://[\w/.-]+} $text range set url [string range $text {*}$range] append result "<a href=\"[string trimright $url .]\">$url</a>" |
