2
# Helper rules for the creation of the memchan website from the .exp files.
3
# General formatting instructions ...
5
proc state {} [list return [file join [pwd] state]]
9
#puts stderr "using $c"
10
if {$c == {}} {return ""}
15
proc nbsp {} {return " "}
16
proc p {} {return <p>}
17
proc ptop {} {return "<p valign=top>"}
18
proc td {} {return "<td [use_bg]>"}
19
proc trtop {} {return "<tr valign=top [use_bg]>"}
20
proc tr {} {return "<tr [use_bg]>"}
21
proc sect {s} {return "<b>$s</b><br><hr>"}
22
proc link {text url} {return "<a href=\"$url\">$text</a>"}
23
proc table {} {return "<table [border] width=100% cellspacing=0 cellpadding=0>"}
24
proc btable {} {return "<table border=1 width=100% cellspacing=0 cellpadding=0>"}
25
proc stable {} {return "<table [border] cellspacing=0 cellpadding=0>"}
28
proc tcl_cmd {cmd} {return "<b>\[$cmd]</b>"}
29
proc wget {url} {exec /usr/bin/wget -q -O - $url 2>/dev/null}
31
proc url {tag text url} {
33
switch -exact -- $what {
34
link {return {<a href="%url%">%text%</a>}}
35
text {return {%text%}}
39
proc $tag {{what link}} [string map [list %text% $text %url% $url] $body]
42
proc img {tag alt img} {
43
proc $tag {} [list return "<img alt=\"$alt\" src=\"$img\">"]
47
proc pagetitle {} [list return $title]
48
return "<html><head><title>[sfproject] @ SourceForge : $title</title><meta name=\"Author\" content=[author]></head><body [use_bg]>"
52
return "<hr>[table][tr]<td align=left><address>[copyright][me]</address></td><td align=right>Last update at [clock format [clock seconds]]</td></tr></table></body></html>"
55
proc protect {text} {return [string map [list & "&" < "<" > ">"] $text]}
57
proc get_changelog {} {
58
set cl [exec [file join [here] .. changelog_to_list] [file join [pwd] .. memchan ChangeLog]]
59
proc get_changelog {} [list return $cl]
64
set cl [get_changelog]
68
foreach {date person items} $chunk break ; # lassign
69
append html "<li><hr><b>[protect $date]</b><p align=right>[protect $person] ...<hr>[p][changelog_items $items][p]\n"
75
proc changelog_items {items} {
82
foreach {key com} $item break
94
append html <dt><i>[protect $key]</i></dt>
96
append html <dd>[protect $com]</dd>\n
100
if {$dlopen} {append html </dl>[p]\n}
102
append html [protect $com]
108
if {$dlopen} {append html </dl>\n}
113
set nfile [file join [state] news]
114
set data [read [set fh [open $nfile r]]][close $fh]
115
return [string trim $data]\n
119
set nfile [file join [state] statistics]
120
set data [read [set fh [open $nfile r]]][close $fh]
122
set data [string trim $data]
124
regsub -all {BGCOLOR="[^"]*"} $data "[use_bg]" data
125
regsub -all {bgcolor="[^"]*"} $data "[use_bg]" data
127
return [string trim $data]\n