summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortwylite <twylite@crypt.co.za>2014-04-28 18:41:05 (GMT)
committertwylite <twylite@crypt.co.za>2014-04-28 18:41:05 (GMT)
commit4cd91634e5e7b92f8b62124418ed5c6b926fc883 (patch)
treec28e1509c84bfde2c23d9dc98ab1ace2294d3d71
parentae044f04702500e3ed688a238fbf06ff63cb3f85 (diff)
downloadtcl-4cd91634e5e7b92f8b62124418ed5c6b926fc883.zip
tcl-4cd91634e5e7b92f8b62124418ed5c6b926fc883.tar.gz
tcl-4cd91634e5e7b92f8b62124418ed5c6b926fc883.tar.bz2
Reintroduce tabular format for alphabetical index of commands, but use CSS columns. Put a categorized list of commands and descriptions below the alphabetical index. Improve discovery of package versions by searching for 'configure.in' with different location/name. Improve discovery of package list file by looking in --pkgdir as well.
-rw-r--r--tools/tcltk-man2html-utils.tcl34
-rwxr-xr-xtools/tcltk-man2html.tcl65
2 files changed, 62 insertions, 37 deletions
diff --git a/tools/tcltk-man2html-utils.tcl b/tools/tcltk-man2html-utils.tcl
index 2c1f412..95552c0 100644
--- a/tools/tcltk-man2html-utils.tcl
+++ b/tools/tcltk-man2html-utils.tcl
@@ -1585,46 +1585,54 @@ proc make-manpage-section {outputDir sectionDescriptor} {
set width [string length $name]
}
}
- set perline [expr {118 / $width}]
- set nrows [expr {([llength $manual(wing-toc)]+$perline)/$perline}]
- set n 0
+ set perline [expr { max(1, min(5, 118 / $width)) }] ;# stylesheet allows 1 to 5 cols
catch { unset toc }
+ catch { unset idx }
foreach name [lsort $manual(wing-toc)] {
set tail $manual(name-$name)
if {[llength $tail] > 1} {
puts stderr "\n$name is defined in more than one file: $tail"
set tail [lindex $tail [expr {[llength $tail]-1}]]
}
- set category ""
+ # Assign man page to a category
+ set category "Uncategorized"
set catMaster $name
if {[info exists manual(cat-master-$name)]} {
set catMaster $manual(cat-master-$name)
}
if {[info exists manual(category-$catMaster)]} {
-#FIXME-TD we want to have the option to group contents by category, if enabled
set category $manual(category-$catMaster)
+ } else {
+ #puts stderr "\n$tail has no .SH CATEGORY"
}
+ # Render link
set tail [file tail $tail]
if {[info exists manual(tooltip-$manual(wing-file)/$tail.htm)]} {
set tooltip $manual(tooltip-$manual(wing-file)/$tail.htm)
set tooltip [string map {[ {\[} ] {\]} $ {\$} \\ \\\\} $tooltip]
regsub {^[^-]+-\s*(.)} $tooltip {[string totitle \1]} tooltip
lappend toc($category) \
- "<li> <a href=\"$tail.htm\" title=\"[subst $tooltip]\">$name</a> $manual(descrip-$name)</li>"
+ "<TD class='command'> <A href=\"$tail.htm\" title=\"[subst $tooltip]\">$name</A> </TD><TD>$manual(descrip-$name)</TD>"
+ lappend idx "<LI> <A href=\"$tail.htm\" title=\"[subst $tooltip]\">$name</A> </LI>"
} else {
lappend toc($category) \
- "<li> <a href=\"$tail.htm\">$name</a> $manual(descrip-$name)</li>"
+ "<TD class='command'> <A href=\"$tail.htm\">$name</A> </TD><TD>$manual(descrip-$name)</TD>"
+ lappend idx "<LI> <A href=\"$tail.htm\">$name</A> </LI>"
}
incr n
}
+ # Render the alphabetical index
+ puts $manual(wing-toc-fp) "<H4>Alphabetical Index</H4>"
+ puts $manual(wing-toc-fp) "<UL class='multicolumn ncols${perline}'>"
+ puts $manual(wing-toc-fp) [join $idx \n]
+ puts $manual(wing-toc-fp) "</UL>"
+ # Render the category lists
+ puts $manual(wing-toc-fp) "<TABLE>"
foreach category [lsort [array names toc]] {
- if { $category ne "" } {
- puts $manual(wing-toc-fp) "<H4>$category</H4>"
- }
- puts $manual(wing-toc-fp) {<ul class="multicolumn">}
- puts $manual(wing-toc-fp) [join $toc($category) \n]
- puts $manual(wing-toc-fp) </ul>
+ puts $manual(wing-toc-fp) "<TR><TD colspan='2'><H4>$category</H4></TD></TR>"
+ puts $manual(wing-toc-fp) "<TR>[join $toc($category) "</TR>\n<TR>"]</TR>"
}
+ puts $manual(wing-toc-fp) "</TABLE>"
#
# insert wing copyrights
diff --git a/tools/tcltk-man2html.tcl b/tools/tcltk-man2html.tcl
index 8ae4079..c15d31a 100755
--- a/tools/tcltk-man2html.tcl
+++ b/tools/tcltk-man2html.tcl
@@ -235,14 +235,22 @@ proc css-stylesheet {} {
font-size: 11px;
}
css-style ul.multicolumn {
+ list-style-type: none;
+ padding-left: 1em;
+ margin: 0;
column-fill: balance;
- column-count: 3;
- -moz-column-count: 3;
- -webkit-column-count: 3;
column-gap: 20px;
-moz-column-gap: 20px;
-webkit-column-gap: 20px;
}
+ css-style ul.ncols1 { column-count: 1; -moz-column-count: 1; -webkit-column-count: 1; }
+ css-style ul.ncols2 { column-count: 2; -moz-column-count: 2; -webkit-column-count: 2; }
+ css-style ul.ncols3 { column-count: 3; -moz-column-count: 3; -webkit-column-count: 3; }
+ css-style ul.ncols4 { column-count: 4; -moz-column-count: 4; -webkit-column-count: 4; }
+ css-style ul.ncols5 { column-count: 5; -moz-column-count: 5; -webkit-column-count: 5; }
+ css-style td.command {
+ padding-left: 1em;
+ }
css-style ".keylist dt" ".arguments dt" {
width: 20em;
float: left;
@@ -684,18 +692,23 @@ try {
# ... but try to extract (name, version) from subdir contents
try {
- set f [open [file join $pkgsDir $dir configure.in]]
- foreach line [split [read $f] \n] {
- if {2 == [scan $line \
- { AC_INIT ( [%[^]]] , [%[^]]] ) } n v]} {
- set description [list $n $v]
- break
+ glob -directory [file join $pkgsDir $dir] -- \
+ configure.in configure.ac unix/configure.in
+ } trap {TCL OPERATION GLOB NOMATCH} {e} {
+ puts stderr "warning: no 'configure.in' (or .ac) under '[file nativename [file join $pkgsDir $dir]]'"
+ } on ok {flist} {
+ try {
+ set f [open [lindex $flist 0]]
+ foreach line [split [read $f] \n] {
+ if {2 == [scan $line \
+ { AC_INIT ( [%[^]]] , [%[^]]] ) } n v]} {
+ set description [list $n $v]
+ break
+ }
}
+ } finally {
+ catch {close $f; unset f}
}
- } trap {POSIX ENOENT} {e} {
- puts stderr "warning: no 'configure.in' in '[file nativename [file join $pkgsDir $dir]]'"
- } finally {
- catch {close $f; unset f}
}
if {[file exists [file join $pkgsDir $dir configure]]} {
@@ -707,26 +720,30 @@ try {
# Get the list of packages to try, and what their human-readable names
# are. Note that the package directory list should be version-less.
- try {
- set packageDirNameMap {}
- if {$build_tcl} {
- set f [open $tcltkdir/$tcldir/pkgs/package.list.txt]
+ set packageDirNameMap {}
+ if {$build_tcl} {
+ set packageDirNameMap {
+ itcl {[incr Tcl]}
+ tdbc {TDBC}
+ thread Thread
+ }
+ foreach pkglistfile [list \
+ [file join $pkgsDir "package.list.txt"] \
+ "$tcltkdir/$tcldir/pkgs/package.list.txt" \
+ ] {
+ puts "checking for package map in '[file nativename [file normalize $pkglistfile]]'"
+ if { ! [file exists $pkglistfile] } continue
+ set f [open $pkglistfile r]
try {
foreach line [split [read $f] \n] {
if {[string trim $line] eq ""} continue
if {[string match #* $line]} continue
- lappend packageDirNameMap {*}$line
+ dict set packageDirNameMap {*}$line
}
} finally {
close $f
}
}
- } trap {POSIX ENOENT} {} {
- set packageDirNameMap {
- itcl {[incr Tcl]}
- tdbc {TDBC}
- thread Thread
- }
}
# Convert to human readable names, if applicable