--- tcltk-man2html.tcl	21 Nov 2009 23:35:45 +0000	1.26
+++ tcltk-man2html.tcl	11 Dec 2009 13:56:33 +0000	
@@ -510,6 +510,7 @@
 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 @@
 	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]
     }
