#!/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 "\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\n" } proc RULE {} { return "\n\n
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") #