|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#!/usr/bin/tclsh
#!/usr/bin/tclsh7.6
#!/usr/bin/expect
#
# (find-fline "~/TH/Generate")
# (find-fline "~/TH/Htmllib.tcl")
# (find-fline "~/TH/Files.tcl")
#
# (find-node "(make)Remaking Makefiles")
# (find-node "(make)Include" "generate dependencies")
# (find-fline "$PAGE2/")
# (find-fline "~/TCL/Makefile.L")
source [file dirname [info script]]/Htmllib.tcl
# (find-angg "TH/Htmllib.tcl")
# (find-angg "TH/Files.tcl")
# (find-es "tcl" "info_script")
# «.link_functions» (to "link_functions")
# «.cgi_links» (to "cgi_links")
# «.forms» (to "forms")
# «.makefile_functions» (to "makefile_functions")
# «.extra_functions» (to "extra_functions")
# «.htmlize» (to "htmlize")
# «.find-» (to "find-")
# «.test_links» (to "test_links")
# «.txt2html» (to "txt2html")
# «.a2html_and_e2html» (to "a2html_and_e2html")
# «.e2html-new» (to "e2html-new")
# «.top_level» (to "top_level")
#%%%%
#
# functions for links
#
#%%%%
# «link_functions» (to ".link_functions")
proc my {fname} { return "$fname" }
proc myl {fname} { return $fname }
procj MYL1 {fname text} {
if {[void $text]} {set text [my $fname]}
HREF1 [relativepathto $fname] $text
}
procj MYURL {url {name {}}} {
relativepathto [expr {$name==""?"$url":"$url#$name"}]
}
procj AURL {astem {name {}}} {
relativepathto [expr {$name==""?"$astem.html":"$astem.html#$name"}]
}
proc section {str} { if {$str==""} {return ""} {return "#$str"} }
proc or {text alt} { expr {$text!=""?$text:$alt} }
procj ESURL {estem {name {}}} {
relativepathto e/$estem.html[section $name]
}
procj ES1 {whereto text} {
foreach {stem name} $whereto {}
L1 [ESURL $stem.e $name] $text
}
procj AL1 {anggurl text} { # experimental version
foreach {astem name} $anggurl {}
L1 [AURL $astem $name] [or $text $astem]
}
procj A0L1 {fname text} { MYL1 $fname $text }
procj PL1 {abslurl text} {
if {[void $text]} {set text $abslurl}
MYL1 $abslurl $text
}
procj IMAGE1 {anggurl text} {
if {[void $text]} {set text $anggurl}
MYL1 $anggurl $text
}
procj IMAGE1 {url text} {
HREF1 $url "<br><img src=\"$url\" alt=\"$text\">\n"
}
procj ML1 {mailadr text} {
if [void $text] {
set text $mailadr
}
HREF1 mailto:$mailadr $text
}
procj MTAL1 {shortfname text} {
if {$text==""} {set text $shortfname}
A0L1 mktclapp-3.9/$shortfname $text
}
procj SL1 {fname text} {
if {$text==""} {set text $fname}
MYL1 $fname $text
}
proc BR {} { return "\n<br>\n" }
proc RULE {} { return "\n\n<hr size=1>\n\n" }
proc ANAME {tag} { return "\n<a name=\"$tag\">\n" }
proc nbytes {fname} {
if {[file exists $fname]} {
return "([file size $fname] bytes)"
}
}
procj MYLBYTES1 {fname txt} {
if {$txt==""} {set txt $fname}
MYL1 $fname "$txt [nbytes $fname]"
}
#%%%%
#
# Functions for links to CGIs
#
#%%%%
# «cgi_links» (to ".cgi_links")
# For info2www cgi calls
# (find-fline "emacs-tutor.th")
#
# (find-fline "/usr/lib/tcl8.0/cgi/cgi.tcl" "{%}")
# (find-fline "/usr/lib/tcl8.0/cgi/cgi.tcl" "format %c 0x")
proc cgiquote {value} {
regsub -all {%} $value "%25" value
regsub -all {#} $value "%23" value
regsub -all {&} $value "%26" value
regsub -all {\+} $value "%2b" value
regsub -all { } $value "+" value
regsub -all {=} $value "%3d" value
return $value
}
proc INFO2WWW {} {
if {[islocal]} {return http://localhost/cgi-bin/info2www}
return http://angg.twu.net/info2www.cgi
}
proc nodehref {infofile short node txt} {
set node [join $node]
if {$txt==""} {set txt "$short$node"}
HREF1 "[INFO2WWW]?($infofile)[cgiquote $node]" $txt
}
procj BASHNODE1 {node txt} { nodehref bash (bash) $node $txt }
procj EFAQNODE1 {node txt} { nodehref emacs-faq (emacs-faq) $node $txt }
procj ELINODE1 {node txt} { nodehref emacs-lisp-intro (elintro) $node $txt }
procj ELNODE1 {node txt} { nodehref elisp (elisp) $node $txt }
procj ENODE1 {node txt} { nodehref emacs-e20 (emacs) $node $txt }
procj GCCNODE1 {node txt} { nodehref gcc (gcc) $node $txt }
procj GDBNODE1 {node txt} { nodehref gdb (gdb) $node $txt }
procj GRUBNODE1 {node txt} { nodehref grub (grub) $node $txt }
procj HURDNODE1 {node txt} { nodehref hurd (hurd) $node $txt }
procj INFONODE1 {node txt} { nodehref info-e20 (info) $node $txt }
procj LIBCNODE1 {node txt} { nodehref libc (libc) $node $txt }
procj LUANODE1 {node txt} { nodehref lua (lua) $node $txt }
procj MAKENODE1 {node txt} { nodehref make (make) $node $txt }
procj MBNODE1 {node txt} { nodehref multiboot (multiboot) $node $txt }
procj TEXINODE1 {node txt} { nodehref texinfo (texinfo) $node $txt }
procj EXPNODE1 {node txt} { nodehref expect (expect) $node $txt }
procj LUANODE1 {node txt} { nodehref lua (lua) $node $txt }
procj LILYNODE1 {node txt} { nodehref lilypond (lilypond) $node $txt }
procj GAWKNODE1 {node txt} { nodehref gawk (gawk) $node $txt }
# 2005jan10
proc nodehref2 {short node txt infourl} {
set node [join $node]
if {$txt==""} {set txt "$short$node"}
regsub -all {[ &<>/]} $node {-} node2
HREF1 "$infourl${node2}.html" $txt
}
procj ENODE1 {node txt} { nodehref2 (emacs) $node $txt \
http://www.gnu.org/software/emacs/manual/html_node/ }
procj ELNODE1 {node txt} { nodehref2 (emacs) $node $txt \
http://www.gnu.org/software/emacs/elisp-manual/html_node/ }
# http://www.gnu.org/software/emacs/elisp-manual/html_node/elisp_toc.html
procj ELINODE1 {node txt} { nodehref2 (elintr) $node $txt \
http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/ }
proc MAN2HTML {} {
if {[islocal]} {return http://localhost/cgi-bin/man2html}
return http://angg.twu.net/cgi-bin/man2html
}
procj MANL1 {n page txt} { HREF [MAN2HTML]?${page}+$n $txt }
#%%%%
#
# Functions for forms.
#
#%%%%
# «forms» (to ".forms")
# For <select> blocks
# (find-fline "search.th")
#
proc1 SELECT1 {name size tag1 text1 otherargs} {
set s "<select name=\"$name\" size=$size>\n"
append s "<option value=\"$tag1\" selected>$text1\n"
foreach {tag text} $otherargs {
append s "<option value=\"$tag\">$text\n"
}
append s "</select>\n"
return $s
}
proc =TAG {head args} {
set s {}
foreach {name value} $args {
if {[regexp {^[0-9A-Za-z]+$} $value]} {
append s " $name=$value"
} else {
append s " $name=\"$value\""
}
}
return "<$head$s>\n"
}
proc Form_ {action method args} {
eval =TAG form action $action method $method $args
}
proc Form {formargs args} {
return "[eval Form_ $formargs]\n[J1 $args]\n</form>\n"
}
proc InputHidden {name value} {
=TAG input type hidden name $name value $value
}
proc InputText {name size args} {
eval =TAG input type text name $name size $size $args
}
proc InputSubmit {args} {
eval =TAG input type submit $args
}
proc TextArea {name cols rows text} {
return "<textarea name=\"$name\" cols=$cols rows=$rows wrap=virtual>
[Q1 $text]
</textarea>\n"
}
proc purebutton {action text} {
return "[Form [list $action get] [InputSubmit value $text]]"
}
#%%%%
#
# Functions for generating makefiles
#
#%%%%
# «makefile_functions» (to ".makefile_functions")
# (find-angg "TH/Files.tcl" "makefile_template")
#
proc replicate_one {ListOfKeysAndDests cluster} {
foreach {key dests} $ListOfKeysAndDests {
if [regexp $key $cluster] {
set result {}
foreach dest $dests {
regsub -all $key $cluster $dest changedcluster
append result $changedcluster
}
return $result
}
}
error "Aaargh, no keys in $cluster"
}
proc replicate_all {ListOfKeysAndDests subject} {
set result {}
while {[regexp {^([^«]*)«([^»]*)»(.*)$} $subject {} beg mid end]} {
append result $beg [replicate_one $ListOfKeysAndDests $mid]
set subject $end
}
append result $subject
return $result
}
#%%%%
#
# Extra functions
#
#%%%%
# «extra_functions» (to ".extra_functions")
# Remove a suffix from a string
proc removetail {tail s} {
set len [string length $s]
set cutpos [expr $len-[string length $tail]]
if {[string range $s $cutpos end]!=$tail} {
error "\{$s\} has tail different from \{$tail\}"
}
return [string range $s 0 [expr $cutpos-1]]
}
# Print a list of e-scripts with descriptions
proc edescrs {} {
global DESTS
source [file dirname [info script]]/Files.tcl
foreach stem $DESTS(estem) {
# set stem [removetail .e $escripte]
set escripte "${stem}.e"
set lines [split [readfile e/$escripte] "\n"]
set s1 {}
set s2 {}
regexp "^# +(E-scripts )?(.*)" [lindex $lines 2] -> {} s1
regexp "^#\[ \t\]+(.*)$" [lindex $lines 3] -> s2
if {$s2!=""} {set s2 " $s2"}
puts " \[escr $stem {$s1$s2}\]"
}
exit
}
#%%%%
#
# htmlize
#
#%%%%
# «htmlize» (to ".htmlize")
proc LocalHack {} {
global outfile
puts $outfile
regsub {.html$} $outfile .th outfileth
IFLR "P ([PL ../R/$outfile rmtv]/[MYL TH/$outfileth src])" \
"P ([HREF index.html home]/[HREF http://angg.twu.net/ angg.twu.net])"
}
proc unlf {str} { join [split $str "\n"] }
# unlf1: keep the lfs only inside the «»s, and remove the «»s.
proc unlf1 {rest} {
set result {}
while {[regexp {^([^«]*)«([^»]*)»(.*)} $rest {} beg mid rest]} {
append result [unlf $beg] $mid
}
append result [unlf $rest]
return $result
}
proc htmlize {title body} {
outputs [TITLEDHTML1 [Q1 $title] "\
[H31 [Q1 $title]]
[E1 [unlf1 $body]]
[LocalHack]"]
}
proc REDIRECTTO {url} {
return "<meta http-equiv=\"refresh\" content=\"2;URL=$url\">"
}
#%%%%
#
# Functions to process "find-" links in converted text
#
#%%%%
# «find-» (to ".find-")
# There are three cases:
#
# flinkli {01(find-23 "45")67}
# -> beg=01 type=23 fname=45 rest={)67} tail=67
#
# flinkli {01(find-23 "45" "67")89}
# -> beg=01 type=23 fname=45 rest={ "67")89} tag=67 tail=89
#
# flinkli {01(find-23 "45" 67)89}
# -> beg=01 type=23 fname=45 rest=??
# this case is so deprecated that I don't make a link from it.
#
# Build the actual html lines (inside a <pre> block) for several types
# of links. The text of the link is the quote/closeparen pair, to
# reduce visual clutter.
#
# (progn (text-mode) (setq fill-prefix " " fill-column 6))
# (progn (text-mode) (setq fill-prefix " " fill-column 70))
# (progn (normal-mode) (setq fill-prefix nil fill-column 70))
proc hasaction {findcmd} {
expr {[lsearch {
eeman find-angg find-angghtml find-bashnode find-deblistsw3
find-e20node find-eev find-efaqnode find-elinode find-elnode
find-enode find-es find-expnode find-fline find-flua find-fluafile
find-gawknode find-gdbnode find-grubnode find-hurdnode
find-infonode find-libcnode find-luanode find-makenode find-node
find-luamanualw3m
find-luamanualw3m+
find-shttpfile find-shttpw3 find-texinode to eevnow-at
} $findcmd]!=-1}
}
proc ifvoid {s casevoid casenonvoid} {
expr {$s==""?$casevoid:$casenonvoid}
}
proc utag {u tag} { expr {$tag==""?$u:[list $u $tag]} }
proc find-fline {qbeg quo qrest fname tag} {
if {[regexp "^~/(.+)" $fname -> f]} {
return "$qbeg[MYL1 $f $quo]$qrest"
} else {
return $qbeg$quo$qrest
}
}
proc eeman {qbeg quo qrest whichpage tag} {
if {[regexp {^(([1-8])[!-~]* +)([!-~]+)$} $whichpage -> _ n page]} {
return "$qbeg[MANL1 $n $page $quo]$qrest"
} else {
return $qbeg$quo$qrest
}
}
proc to {qbeg quo qrest tag nil} {
return "$qbeg[HREF1 #$tag $quo]$qrest"
}
proc eevnow-at {qbeg quo qrest tag nil} {
return "$qbeg[HREF1 #$tag $quo]$qrest"
}
proc find-angg {qbeg quo qrest fname tag} {
return "$qbeg[AL1 [utag $fname $tag] $quo]$qrest"
}
proc find-angghtml {qbeg quo qrest fname tag} {
return "$qbeg[MYL1 [utag $fname $tag] $quo]$qrest"
}
proc find-eev {qbeg quo qrest fname tag} {
return "$qbeg[AL1 eev-current/[utag $fname $tag] $quo]$qrest"
}
proc find-es {qbeg quo qrest stem tag} {
return "$qbeg[ES1 [ifvoid $tag $stem [list $stem $tag]] $quo]$qrest"
}
proc find-shttpw3 {qbeg quo qrest urlstem tag} {
return "$qbeg[L http://$urlstem $quo]$qrest"
}
proc find-shttpfile {qbeg quo qrest urlstem tag} {
return "$qbeg[L http://$urlstem $quo]$qrest"
}
proc find-deblistsw3 {b q r urlstem tag} {
# find-shttpw3 $b $q $r www.debian.org/Lists-Archives/$urlstem $tag
find-shttpw3 $b $q $r lists.debian.org/$urlstem $tag
}
proc find-flua {qbeg quo qrest fname tag} {
return "$qbeg[AL1 [utag LUA/flua-0.02/$fname $tag] $quo]$qrest"
}
proc find-fluafile {qbeg quo qrest fname tag} {
return "$qbeg[MYL1 LUA/flua-0.02/$fname $quo]$qrest"
}
proc find-flua {qbeg quo qrest fname tag} {
return "$qbeg[AL1 [utag LUA/flua-0.02/$fname $tag] $quo]$qrest"
}
proc find-luamanualw3m+ {qbeg quo qrest tag etc} {
return "$qbeg[HREF1 [relativepathto LUA/manual2.html\#$tag] $quo]$qrest"
}
proc find-luamanualw3m {qbeg quo qrest tag etc} {
return "$qbeg[HREF1 [relativepathto LUA/manual2.html\#$tag] $quo]$qrest"
}
proc find-xxxnode {qbeg quo qrest node tag fun} {
return "$qbeg[$fun $node $quo]$qrest"
}
proc find-bashnode {b q r n t} { find-xxxnode $b $q $r $n $t BASHNODE1 }
proc find-e20node {b q r n t} { find-xxxnode $b $q $r $n $t ENODE1 }
proc find-efaqnode {b q r n t} { find-xxxnode $b $q $r $n $t EFAQNODE1 }
proc find-elinode {b q r n t} { find-xxxnode $b $q $r $n $t ELINODE1 }
proc find-elnode {b q r n t} { find-xxxnode $b $q $r $n $t ELNODE1 }
proc find-enode {b q r n t} { find-xxxnode $b $q $r $n $t ENODE1 }
proc find-expnode {b q r n t} { find-xxxnode $b $q $r $n $t EXPNODE1 }
proc find-gawknode {b q r n t} { find-xxxnode $b $q $r $n $t GAWKNODE1 }
proc find-gccnode {b q r n t} { find-xxxnode $b $q $r $n $t GCCNODE1 }
proc find-gdbnode {b q r n t} { find-xxxnode $b $q $r $n $t GDBNODE1 }
proc find-grubnode {b q r n t} { find-xxxnode $b $q $r $n $t GRUBNODE1 }
proc find-hurdnode {b q r n t} { find-xxxnode $b $q $r $n $t HURDNODE1 }
proc find-infonode {b q r n t} { find-xxxnode $b $q $r $n $t INFONODE1 }
proc find-libcnode {b q r n t} { find-xxxnode $b $q $r $n $t LIBCNODE1 }
proc find-lilynode {b q r n t} { find-xxxnode $b $q $r $n $t LILYNODE1 }
proc find-luanode {b q r n t} { find-xxxnode $b $q $r $n $t LUANODE1 }
proc find-makenode {b q r n t} { find-xxxnode $b $q $r $n $t MAKENODE1 }
proc find-texinode {b q r n t} { find-xxxnode $b $q $r $n $t TEXINODE1 }
proc find-node {b q r bignode t} {
if {[regexp {^\(([^)]+)\)(.*)$} $bignode -> infofile n]} {
switch $infofile {
bash {return [find-bashnode $b $q $r $n $t]}
elisp {return [find-elnode $b $q $r $n $t]}
emacs-e20 {return [find-enode $b $q $r $n $t]}
emacs-lisp-intro {return [find-elinode $b $q $r $n $t]}
gcc {return [find-gccnode $b $q $r $n $t]}
gdb {return [find-gdbnode $b $q $r $n $t]}
grub {return [find-grubnode $b $q $r $n $t]}
libc {return [find-libcnode $b $q $r $n $t]}
make {return [find-makenode $b $q $r $n $t]}
expext {return [find-expnode $b $q $r $n $t]}
lua {return [find-luanode $b $q $r $n $t]}
lilypond {return [find-lilynode $b $q $r $n $t]}
gawk {return [find-gawknode $b $q $r $n $t]}
}
}
return $b$q$r
}
# «test_links» (to ".test_links")
# This should be a list of all the elisp hyperlinks that are converted
# into something that will (hopefully) work in the HTML version.
# (find-shttpw3 "angg.twu.net/eev.html#htmlization")
# (eev "makeL && lynx ~/TH/L/TH/Generate.html#test_links")
#
# (eeman "3tcl info")
# (find-angg "TH/Generate" "test_links")
# (find-angghtml "emacs.html" "glyphs")
# (find-deblistsw3 "debian-mentors-0007/msg00089.html")
# (find-es "page")
# (find-es "page" "info2www_twu")
# (find-fline "~/TH/Generate")
# (find-fline "/usr/doc/grub/")
# (find-flua "flua.lua")
# (find-flua "flua.lua" "command_line")
# (find-fluafile "demo2.bytecode.lst")
# (find-sftpfile "ftp.math.mcgill.ca/pub/rags/SeelyRAG.bib")
# (find-shttpfile "www.mat.puc-rio.br/~edrx/")
# (find-shttpw3 "www.mat.puc-rio.br/~edrx/")
# (to "test_links")
# (eevnow-at "test_links")
#
# (find-bashnode "Top")
# (find-e20node "Top")
# (find-efaqnode "Top")
# (find-elinode "Top")
# (find-elnode "Top")
# (find-enode "Top")
# (find-gccnode "Top")
# (find-gdbnode "Top")
# (find-grubnode "Top")
# (find-hurdnode "Top")
# (find-infonode "Top")
# (find-libcnode "Top")
# (find-makenode "Top")
# (find-texinode "Top")
# (find-expnode "Top")
# (find-luanode "Top")
# (find-lilynode "Top")
# (find-node "(bash)Top")
# (find-node "(elisp)Top")
# (find-node "(emacs-e20)Top")
# (find-node "(emacs-lisp-intro)Top")
# (find-node "(gcc)Top")
# (find-node "(gdb)Top")
# (find-node "(grub)Top")
# (find-node "(libc)Top")
# (find-node "(make)Top")
# (find-node "(expect)Top")
# (find-node "(lua)Top")
# (find-node "(lilypond)Top")
#%%%%
#
# txt2html
#
#%%%%
# «txt2html» (to ".txt2html")
# Top level: takes an escript line containing a "find-" and
# converts it (or not).
#
proc flinkli {li} {
if {[regexp "^(.*)\\((find-\[^ \]+|to|eeman|eevnow-at)\[ \t\]+(.*)" $li \
-> beg findcmd rest]} {
if {[hasaction $findcmd]} {
#
# regexp: bbbbbtcccccccccccctb rrrr
if {[regexp {^"([^\"]+)(" +"((\\.|[^\"])*))?"\)(.*)$} $rest -> \
fname bigtag tag c rest]} {
if {$bigtag==""} {
return [$findcmd [Q1 "${beg}($findcmd \"$fname"] \
"\")" [Q1 $rest] \
$fname {}]
} else {
return [$findcmd [Q1 "${beg}($findcmd \"$fname$bigtag"] \
"\")" [Q1 $rest] \
$fname $tag]
}
}
}
}
return [Q1 $li]
}
proc anchorli2html {beg mid end} {
set greentag [COLOR green [IT «\;]$mid[IT »\;]]
return [txt2html $beg][NAME $mid $greentag][txt2html $end]
}
proc txt2html {bigstr} {
set hs {}
foreach li [split $bigstr "\n"] {
if [regexp {«|\(find-|\(to|\(eeman|\(eevnow-at} $li] {
if [regexp "^(.*)«(\[^<>«»\]*)»(.*)$" $li {} beg mid end] {
# lappend hs [NAME $mid $beg\
# [COLOR green [IT «\;]$mid[IT »\;]]$end]
lappend hs [anchorli2html $beg $mid $end]
} else {
lappend hs [flinkli $li]
}
} else {
lappend hs [Q1 $li]
}
}
set bigstr [join $hs "\n"]
regsub -all "*" $bigstr [COLOR red [BF *]] bigstr
return $bigstr
}
#%%%%
#
# a2html and e2html
#
#%%%%
# «a2html_and_e2html» (to ".a2html_and_e2html")
# <table>
# <tr>
# <td bgcolor="#CC0000">
# <font color="#FFCC00">
# Warning: this is a htmlized version!
# <br>
# The original is across
# <a href="../e/x.e">this link.</a>
# </font>
# </td>
# </tr>
# </table>
proc WARN_HTMLIZED {orig unglyphed} {
if {$unglyphed!=""} {
set unglyphed [relativepathto $unglyphed]
return \
"<table><tr><td bgcolor=\"#CC0000\"><font color=\"#FFCC00\" size=-1>
Warning: this is a htmlized version!
<br>The original is across [HREF $orig this link],
<br>and a version of it with the [MYL emacs.html#glyphs wild \
<br>characters] tamed can be found [HREF $unglyphed here].
</font></td></tr></table>\n\n"
} else {
return \
"<table><tr><td bgcolor=\"#CC0000\"><font color=\"#FFCC00\" size=-1>
Warning: this is a htmlized version!
<br>The original is across [HREF $orig this link]\;
<br>it may have some [MYL eev-current/glyphs.el.html strange characters].
</font></td></tr></table>\n\n"
}
}
proc a2html {sourcefile {unglyphedsource {}}} {
# regexp "^a/(.*)" $sourcefile -> source
set source $sourcefile
outputs [TITLEDHTML "$source (htmlized)" \
[WARN_HTMLIZED $source $unglyphedsource] \
[PRE1 [txt2html [readfile $sourcefile]]]]
}
## This was replaced by something more complex:
#proc e2html {sourcefile} {
# set tail [file tail $sourcefile]
# outputs [TITLEDHTML "$tail (htmlized)" \
# [WARN_HTMLIZED ../a/e/$tail] \
# [PRE1 [txt2html [readfile $sourcefile]]]]
#}
# (find-fline "~/TCL/fix-eheaders")
# (find-fline "~/EXPECT/eheaders")
proc EHREF {dest} { return "<[HREF $dest $dest]>" }
proc EHREFR {dest {html {}}} {
regexp "http://angg.twu.net/(.*)" $dest -> fname
if {$html==""} {
return "<[HREF ../$fname $dest]>"
} else {
return "<[HREF ../$fname $dest]\[[HREF ../$fname.html .html]\]>"
}
}
proc e2html {sourcefile {unglyphed {}}} {
set tail [file tail $sourcefile]
set contents [readfile $sourcefile]
set v "#\n"
set nv "#\[^\n\]+\n"
set com "#\[^\n\]*\n"
set bigre "^$nv${v}(($nv)+)${v}(($com)+)(.*)\$"
if {![regexp $bigre $contents -> descr {} hrest {} rest]} {
error "Bad efile: $sourcefile"
}
set eev1 [AL {eev/README} eev.el]
set zshrc1 [AL {.zshrc ee} .zshrc]
set emacs1 [AL {.emacs code-c-ds} .emacs]
outputs [TITLEDHTML "$tail (htmlized)" \
[WARN_HTMLIZED $tail $unglyphed] \
[PRE1 \
"#######
#
[Q1 $descr]#
# Note 1: use the eev command (defined in $eev1) and the
# ee alias (in my $zshrc1) to execute parts of this file.
# Executing this file as a whole makes no sense.
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like [ES {bash pipe_stdout_stderr} |&]
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# $emacs1.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias. Main exception: [AL EXPECT/eeg eeg].
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at [EHREF http://angg.twu.net/e/$tail]
# or at [EHREF http://angg.twu.net/e/$tail.html].
# See also [EHREFR http://angg.twu.net/emacs.html],
# [EHREFR http://angg.twu.net/.emacs .html],
# [EHREFR http://angg.twu.net/.zshrc .html],
# [EHREFR http://angg.twu.net/escripts.html],
# and [EHREF http://angg.twu.net/].
#
#######
[txt2html $rest]"]]
}
#%%%%
#
# Top level stuff (or: how to invoke this script)
#
#%%%%
# «top_level» (to ".top_level")
# The first argument sets "outfile"; "-" means stdout.
# All other arguments are digested in order; those that don't have
# spaces are interpreted as names of files to source, the ones with
# spaces are evaluated.
set outfile [lindex $argv 0]
foreach s [lrange $argv 1 end] {
if {[regexp " " $s]} {
eval $s
} else {
source $s
}
}
exit
# Local Variables:
# coding: raw-text-unix
# ee-anchor-format: "«%s»"
# ee-charset-indicator: "Ñ"
# End: