Documentation Source Text

Artifact [82269a5c60]
Login

Artifact 82269a5c602ae56bc1d6f24d3f8c26b8318a3365658787d6cc4c1c36443eaac1:


eval [db one {SELECT sqlar_uncompress(data,sz) FROM sqlar
               WHERE name='wapp.tcl'}]
proc wapp-default {} {
  global wapp
  set x [string trimleft [dict get $wapp PATH_INFO] /]
  if {$x==""} {set x index.html}
  set doc [db one {SELECT sqlar_uncompress(data,sz)
                   FROM sqlar WHERE name=('doc/' || $x)}]
  if {$doc==""} {
    wapp-subst {<h1>Not Found: %html(/$x)</h1>}
    return
  }
  dict set wapp .reply $doc
  switch -glob -- $x {
    *.html {wapp-mimetype text/html}
    *.gif {wapp-mimetype image/gif}
    *.jpg {wapp-mimetype image/jpeg}
    *.png {wapp-mimetype image/png}
    *.css {wapp-mimetype text/css}
    default {wapp-mimetype text/html}
  }
}
if {[regexp {^-?-h(elp)?$} [lindex $argv 0]]} {
  puts [wapp-help]
  exit
}
wapp-start $argv