swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit 26dcb1bde3d31a9608487766925c8452a2ea0a4c
parent e455395fe4b06902be39f7326e795c7b16ffd362
Author: anselm@garbe.us <unknown>
Date:   Sun, 12 Feb 2012 17:29:17 +0100

removed lib/ dir, not needed
Diffstat:
Mbin/corehandlers.rc | 2+-
Mbin/werc.rc | 4++--
Mbin/werclib.rc | 14++++----------
Apub/style1.css | 156+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rlib/404.tpl -> tpl/404.tpl | 0
Rlib/default_master.tpl -> tpl/default_master.tpl | 0
Rlib/headers.tpl -> tpl/headers.tpl | 0
7 files changed, 163 insertions(+), 13 deletions(-)

diff --git a/bin/corehandlers.rc b/bin/corehandlers.rc @@ -145,7 +145,7 @@ fn setup_handlers { # This function allows config files to define their own 404 handlers. fn setup_404_handler { - handler_body_main=(tpl_handler `{get_lib_file 404.tpl}) + handler_body_main=(tpl_handler `{get_tpl_file 404.tpl}) echo 'Status: 404 Not Found' dprint 'NOT FOUND: '$SERVER_NAME^$"REQUEST_URI^' - '^$"HTTP_REFERER^' - '^$"HTTP_USER_AGENT } diff --git a/bin/werc.rc b/bin/werc.rc @@ -17,7 +17,7 @@ dirclean=' s/\.(md|html|txt|1)$//; ' # Careful, the proper p9p path might not be set until initrc.local is sourced path=(. $PLAN9/bin ./bin /bin /usr/bin) -headers=lib/headers.tpl +headers=tpl/headers.tpl res_tail='</body></html>' http_content_type='text/html' ll_add handlers_bar_left nav_tree @@ -33,7 +33,7 @@ fn werc_exec_request { site=$SERVER_NAME base_url=http://$site sitedir=$sitesdir/$site - master_template=`{get_lib_file default_master.tpl} + master_template=`{get_tpl_file default_master.tpl} current_date_time=`{date} # Note: $REQUEST_URI is not officially in CGI 1.1, but seems to be de-facto diff --git a/bin/werclib.rc b/bin/werclib.rc @@ -1,14 +1,8 @@ -fn get_lib_file { - if(! ~ $#sitedir 0 && test -f $sitedir/_werc/lib/$1) - echo -n $sitedir/_werc/lib/$1 - if not if(! ~ $#masterSite 0 && test -f $sitesdir/$masterSite/_werc/lib/$1) - echo -n $sitesdir/$masterSite/_werc/lib/$1 - if not if(test -f lib/$1) - echo -n lib/$1 - if not if(~ $#* 2) - echo -n $2 +fn get_tpl_file { + if(test -f tpl/$1) + echo -n tpl/$1 if not - status='Can''t find lib file: '$1 + status='Can''t find tpl file: '$1 } fn template { awk -f bin/template.awk $* | rc $rcargs } diff --git a/pub/style1.css b/pub/style1.css @@ -0,0 +1,156 @@ +body { + background-color: #333; + color: #ddd; + font-family: Helvetica, Verdana, Arial, 'Liberation Sans', FreeSans, sans-serif; + padding: 0; + margin: 0; +} + +a { + color: #6af; + text-decoration: none; +} + +a:hover { + color: #999; +} + +#menu { + clear: both; + color: #ccc; + background-color: #057; + padding: 0.7ex; + font-size: 84%; +} + +#menu a { + padding: 0.5ex 1ex 0.5ex 1ex; + color: #eee; +} + +#menu a:hover { + color: #ccc; +} + +#header { + clear: both; + color: #ddd; + text-shadow: 1px 1px #000; + font-size: 1.7em; + padding: 0.7ex 0.7ex 0.7ex 0.7em; + border-top: 1px solid #444; +} + +#header a { + color: #ddd; +} + +h1 { + margin: 1em 1ex 0.5ex 0; + font-size: 1.4em; +} + +h2 { + margin: 1em 1ex 0.5ex 0; + font-size: 1.3em; +} + +h3 { + margin: 1em 1ex 0.5ex 0; + font-size: 1.2em; +} + +h4 { + margin: 1em 1ex 0.5ex 0; + font-size: 1.1em; +} + +#headerSubTitle { + font-size: 0.8em; + font-style: italic; + margin-left: 1em; +} + +#content { + clear: both; + margin: 0; + padding: 0; + background-color: #222; + overflow: hidden; + border-top: 1px solid #444; + border-bottom: 1px solid #444; +} + +#nav { + background-color: #222; + float: left; + margin: 0 1px 0 0; + padding: 1em 0; + border-right: 1px dotted #444; + width: 200px; +} + +#nav ul { + margin: 0; + padding: 0; +} + +#nav li { + list-style: none; + padding: 0; + margin: 0; +} + +#nav li ul { + padding-left: 0.6em !important; +} + +#nav li a { + color: #6af; + display: block; + margin: 0; + padding: 0.8ex 2em 0.8ex 1em; +} + +#nav li a:hover { + background: #057; + color: #ddd; +} + +#nav li a.thisPage { + color: #ddd; + font-weight: bold; + font-style: italic; +} + +#main { + margin: 0 0 0 200px; + padding: 1.5em; + max-width: 50em; + text-align: justify; +} + +#ads { + float:right; + padding: 1em; +} + +#footer { + clear: both; + color: #ddd; + font-size: 84%; + padding: 1em; + margin: 0 0 1.5em 0; +} + +.left { + float: left; + margin: 0; + padding: 0; +} + +.right { + float: right; + margin: 0; + padding: 0; +} diff --git a/lib/404.tpl b/tpl/404.tpl diff --git a/lib/default_master.tpl b/tpl/default_master.tpl diff --git a/lib/headers.tpl b/tpl/headers.tpl