Here's some Tcl code I cooked up to split ACEDB's help.wrm file
into HTML for Web browsing.
Next, I'll hack WebAce to link through displays.wrm to the help
html files.
#!/usr/local/bin/tclsh
#
# makehelp.tcl
#
# converts Acedb wspec/help.wrm style files
# into a directory of HTML documents.
#
# example:
# tcl/makehelp.tcl wspec/help.wrm /usr/local/Web/flydb
#
# by Henry J. Cobb, June 13th, 1994.
#
set helpsource [lindex $argv 0]
set helpdir [lindex $argv 1]
set fh [open $helpsource r]
while {[gets $fh line] >= 0} {
if [string match {\*\**} $line] {
set words [split $line " "]
set key [string trim [lindex $words 0] {* }]
if [string length $key] {
lappend myindex $key
}
}
}
close $fh
set helpindex "$helpdir/index.html"
set fh [open $helpindex w]
puts $fh {<HEAD>}
puts $fh {<TITLE>Flydb Help Index</TITLE>}
puts $fh {</HEAD>}
puts $fh ""
puts $fh {<BODY>}
foreach key $myindex {
puts $fh "<a href=\"http:$key.html\">$key</a>"
puts $fh {<br>}
}
puts $fh {</BODY>}
close $fh
set fh [open $helpsource r]
set helpfile ""
set hfh ""
while {[gets $fh line] >= 0} {
if [string match {\*\**} $line] {
set words [split $line " "]
set key [string trim [lindex $words 0] {* }]
if [string length $key] {
if [string length $helpfile] {
puts $hfh {</PRE>}
puts $hfh {</BODY>}
close $hfh
}
set helpfile "$helpdir/$key.html"
set hfh [open $helpfile w]
puts $hfh {<HEAD>}
puts $hfh "<TITLE>Flydb Help on $key</TITLE>"
puts $hfh {</HEAD>}
puts $hfh ""
puts $hfh {<BODY>}
puts $hfh "(<a href=\"http:index.html\">Index</a>) "
puts $hfh " (<a href=\"http:Help.html\">Help on Help</a>)"
puts $hfh "<H1>$line</H1>"
puts $hfh {<PRE>}
}
} else {
#Normal line of text
if [string length $helpfile] {
set words [split $line " "]
foreach key $words {
if {-1 == [set myoffset [lsearch -exact $myindex $key]]} {
puts -nonewline $hfh "$key "
} else {
puts -nonewline $hfh "<a href=\"http:$key.html\">$key</a> "
}
}
puts $hfh ""
}
}
}
puts $hfh {</PRE>}
puts $hfh {</BODY>}
close $hfh
--
Henry J. Cobb hcobb at fly2.berkeley.edu, Bad-Think Criminal
This is a fat cross platform .sig virus,
able to run on many different platforms.