commit 36f71f8286299baa8c21712253c7981cf397d88a
parent f565ccc661ab80a7bf0a06334e2b8b9b1ec0b645
Author: garbeam@gmail.com <unknown>
Date: Sat, 4 Feb 2012 16:17:57 +0100
merged uriels changes
Diffstat:
6 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/README b/README
@@ -13,8 +13,14 @@ Installation
Requirements:
-* Plan 9 from User Space: http://plan9.us - Or 9base-5 or later: http://tools.suckless.org/9base
* An http server that can handle CGIs
+* Plan 9 from User Space: http://plan9.us - Or 9base-5 or later: http://tools.suckless.org/9base
+
+Note: Werc by default expects the Plan 9 tools to be installed under
+/usr/local/plan9/bin/, if you have installed them elsewhere you will need to
+edit the #! line in bin/werc.rc and customize the $plan9port variable in your
+etc/initrc.local.
+
Instructions:
diff --git a/apps/wman/app.rc b/apps/wman/app.rc
@@ -1,4 +1,5 @@
fn conf_enable_wman {
+ wman_tmac=an
wman_base_uri=$conf_wd
wman_man_path=$*
if(~ $#wman_man_path 0)
@@ -6,7 +7,7 @@ fn conf_enable_wman {
conf_enable_app wman
}
-wman_junk_filter='/(\/(INDEX|\.cvsignore)|\.9p|\.html)$/d; s!/man([0-9]+/[^/]+)$!/\1!; '
+wman_junk_filter='/(\/(INDEX|\.cvsignore|_.*)|\.9p|\.html)$/d; s!/man([0-9]+/[^/]+)$!/\1!; '
fn wman_ls_pages {
ls $* \
| sed $dirfilter^$wman_junk_filter^' s/\.([0-9]|9p)$//; s!/0intro$!/intro!' \
@@ -70,8 +71,19 @@ fn wman_get_section_desc {
fn wman_page_gen {
#troff -manhtml $1| troff2html -t 'Plan 9 from User Space'
- troff -N -man $1 \
- | escape_html \
+ # Using GNU col here to remove nroffs garbage (eg., from .ft B); p9p has no col(1) :(
+ troff -N -m$wman_tmac $1 | wman_out_filter
+}
+
+fn wman_out_filter {
+ wman_default_out_filter
+}
+
+fn wman_default_out_filter {
+ escape_html \
| sed 's!([\.\-a-zA-Z0-9]+)\(('^`{echo $wman_cat_list|tr ' ' '|'}^')\)!<a href="../\2/\1">&</a>!g' \
| awk '/^$/ {if(n != 1) print; n=1; next} /./ {n=0; print}'
+
}
+
+
diff --git a/bin/corehandlers.rc b/bin/corehandlers.rc
@@ -83,7 +83,7 @@ fn dir_listing_handler {
d='/'
echo $d|sed 's,.*//,,g; s,/$,,; s,/, / ,g; s/[\-_]/ /g; s,.*,<h1 class="dir-list-head">&</h1> <ul class="dir-list">,'
# Symlinks suck: '/.' forces ls to list the linked dir if $d is a symlink.
- ls -F $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean | awk '{match($0, "/[^/]*/?$"); l=substr($0, RSTART+1, RLENGTH-1);n=l; gsub(/[\-_]/, " ", n); print "<li><a href=\""l"\">"n"</a></li>"; }'
+ ls -F $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean | awk '{match($0, "/[^/]*/?$"); l=substr($0, RSTART+1, RLENGTH-1);n=l; gsub(/[\-_]/, " ", n); print "<li><a href=\""l"\">"n"</a></li>"; }' | uniq
echo '</ul>'
}
diff --git a/bin/werc.rc b/bin/werc.rc
@@ -42,7 +42,7 @@ fn werc_exec_request {
# Note: $REQUEST_URI is not officially in CGI 1.1, but seems to be de-facto
# Note: We only urldecode %5F->'_' because some sites (stackoverflow.com?) urlencode it in their links,
- # perhaps we should completel urldecode the whole url.
+ # perhaps we should completely urldecode the whole url.
req_path=`{echo -n $REQUEST_URI | sed 's/\?.*//; s!//+!/!g; s/%5[Ff]/_/g; s/'^$forbidden_uri_chars^'//g; s/\.\.*/./g; 1q'}
req_url=$base_url^$req_path
local_path=$sitedir$req_path
@@ -135,4 +135,4 @@ fn werc_exec_request {
echo $res_tail
}
-werc_exec_request
+werc_exec_request # >[2]/tmp/wercdebug.log
diff --git a/bin/werclib.rc b/bin/werclib.rc
@@ -102,7 +102,7 @@ fn get_html_title {
# As a backup we might want to pick the first 'non-tag' text in the file with:
if(~ $"t '')
- t=`{sed -n -e 's/^(<[^>]+>)*([^<]+).*/\2/p; 32q' < $1 | sed 1q}
+ t=`{sed -n -e 's/^[ ]*(<[^>]+>)*([^<]+).*/\2/p; 32q' < $1 | sed 1q}
echo $t
}
diff --git a/etc/initrc b/etc/initrc
@@ -14,6 +14,9 @@ plan9port=$PLAN9
# If you use 9base, it should point to your 9base root, try for example:
#plan9port=/usr/lib/9base # This is the default 9base install path in Debian.
+# If rc is not installed as /usr/local/plan9/bin/rc you will also need to change
+# the #! line in bin/werc.rc!
+
# Path, make sure the plan9port /bin directory is included before /bin
# Keep '.' in path! It is needed.
path=($plan9port/bin . ./bin ./bin/contrib /bin /usr/bin)