summaryrefslogtreecommitdiffstats
path: root/tools/tcltk-man2html.tcl
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-12-11 14:08:44 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-12-11 14:08:44 (GMT)
commitaa95261cdb411081d54b92f009404f83954deec1 (patch)
tree6146163b8aa2f8fbc1e85e1fa3c0ac7c3c948d2b /tools/tcltk-man2html.tcl
parent5f4b06d848afc2095f6309a653fe773db565f425 (diff)
downloadtcl-aa95261cdb411081d54b92f009404f83954deec1.zip
tcl-aa95261cdb411081d54b92f009404f83954deec1.tar.gz
tcl-aa95261cdb411081d54b92f009404f83954deec1.tar.bz2
[FRQ 2897296]: Cross-links to sections within a manpage when in HTML.
Diffstat (limited to 'tools/tcltk-man2html.tcl')
-rwxr-xr-xtools/tcltk-man2html.tcl12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl
index 4b669ad..d758edb 100755
--- a/tools/tcltk-man2html.tcl
+++ b/tools/tcltk-man2html.tcl
@@ -113,7 +113,7 @@ proc parse_command_line {} {
if {$build_tk} {
# Find Tk.
set tkdir [lindex [lsort [glob -nocomplain -tails -type d \
- -directory $tcltkdir tk$useversion]] end]
+ -directory $tcltkdir tk$useversion]] end]
if {$tkdir eq ""} {
puts stderr "tcltk-man-html: couldn't find Tk below $tcltkdir"
exit 1
@@ -232,7 +232,7 @@ proc htmlhead {title header args} {
}
proc gencss {} {
set hBd "1px dotted #11577b"
- return "
+ return [subst {
body, div, p, th, td, li, dd, ul, ol, dl, dt, blockquote {
font-family: Verdana, sans-serif;
}
@@ -308,7 +308,7 @@ h4 { font-size: 11px; }
border-top: 1px solid #6A6A6A;
margin-top: 2em;
}
-"
+}]
}
##
@@ -510,6 +510,7 @@ proc man-puts {text} {
proc long-toc {text} {
global manual
set here M[incr manual(section-toc-n)]
+ set manual($manual(name)-id-$text) $here
set there L[incr manual(long-toc-n)]
lappend manual(section-toc) \
"<DD><A HREF=\"$manual(name).htm#$here\" NAME=\"$there\">$text</A>"
@@ -837,6 +838,11 @@ proc cross-reference {ref} {
set lref $ref
} elseif {$ref eq "Tcl"} {
set lref $ref
+ } elseif {[regexp {^[A-Z0-9 ?!]+$} $ref]} {
+ if {[info exists manual($manual(name)-id-$ref)]} {
+ return "<A HREF=\"#$manual($manual(name)-id-$ref)\">$ref</A>"
+ }
+ set lref [string tolower $ref]
} else {
set lref [string tolower $ref]
}