File: man2html-fixindex.tcl

package info (click to toggle)
tix 8.4.3-4
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 8,448 kB
  • ctags: 6,844
  • sloc: ansic: 28,077; tcl: 22,774; python: 7,577; makefile: 332; cs: 253; sh: 185; perl: 128
file content (133 lines) | stat: -rw-r--r-- 2,854 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# man2html-fixindex.tcl
#
#       Updates the index file generated by tix-man2html.tcl
#       in a format more suitable for Tix
#
#       This program is dependent on the specific HTML format
#       generated by ./tix-man2html.tcl.
#
# $Id: man2html-fixindex.tcl,v 1.1 2001/01/22 08:18:35 ioilam Exp $

set root [lindex $argv 0]
set file [file join $root contents.htm]
set fd [open $file RDONLY]
set data [read $fd]
close $fd

#
# Remove the link about Tix Commands
#
regsub "<DT><A HREF=\"TixCmd\[^\n\]*\n" $data "" data

set std {
    tixGrid 
    tixHList 
    tixInputOnly 
    tixNBFrame 
    tixTList 
}
set mega {
    tixBalloon 
    tixButtonBox 
    tixCheckList 
    tixComboBox 
    tixControl 
    tixDirList 
    tixDirSelectDialog 
    tixDirTree 
    tixExFileSelectBox 
    tixExFileSelectDialog 
    tixFileEntry 
    tixFileSelectBox 
    tixFileSelectDialog 
    tixLabelEntry 
    tixLabelFrame 
    tixListNoteBook 
    tixMeter 
    tixNoteBook 
    tixOptionMenu 
    tixPanedWindow 
    tixPopupMenu 
    tixScrolledHList 
    tixScrolledListBox 
    tixScrolledText 
    tixScrolledWindow 
    tixSelect 
    tixStdButtonBox 
    tixTree
}
set img {
    compound 
    pixmap 
}
set other {
    tixDestroy 
    tixDisplayStyle 
    tixForm 
    tixMwm 
    tix 
    tixGetBoolean 
    tixGetInt 
    tixUtils
}
set progs  {
    tixwish
}

#
# returns the links to the list of man pages in an HTML table.
#
proc section {name dir list} {
    set tab_width 4

    append html <b>$name</b>\n
    append html <blockquote>\n
    append html {<TABLE>}

    set tab_height [expr ([llength $list] + $tab_width - 1) / $tab_width]
    for {set i 0} {$i < $tab_height} {incr i} {
        append html {<TR>}
        for {set j 0} {$j < $tab_width} {incr j} {
            set idx [expr ($j * $tab_height) + $i]
            append html <TD>
            if {$idx < [llength $list]} {
                set page [lindex $list $idx]
                append html "<A HREF=$dir/$page.htm>$page</A>"
            } else {
                append html ""
            }
            append html </TD>
        }
        append html </TR>
    }

    append html </TABLE>
    append html </blockquote>\n
    append html \n
    return $html
}

#
# Add Tix commands to the page with better categorization.
#

append tixdata {
    <blockquote>
    
    <b><a href=TixCmd/TixIntro.htm#M3>
    Introduction to the Tix Library</a></b>

    </blockquote>
}
append tixdata [section {Tix Standard Widgets} TixCmd $std]
append tixdata [section {Tix Mega Widgets} TixCmd $mega]
append tixdata [section {Tix Image Types} TixCmd $img]
append tixdata [section {Tix Core Commands} TixCmd $other]
append tixdata [section {Tix User Programs} UserCmd $progs]

regsub </H3> $data </H3>$tixdata data

set fd [open $file {WRONLY TRUNC CREAT}]
puts -nonewline $fd $data
close $fd