merged uriels changes - swerc - anselm's simpler werc fork | |
git clone git://git.suckless.org/swerc | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 36f71f8286299baa8c21712253c7981cf397d88a | |
parent f565ccc661ab80a7bf0a06334e2b8b9b1ec0b645 | |
Author: [email protected] <unknown> | |
Date: Sat, 4 Feb 2012 16:17:57 +0100 | |
merged uriels changes | |
Diffstat: | |
M README | 8 +++++++- | |
M apps/wman/app.rc | 18 +++++++++++++++--- | |
M bin/corehandlers.rc | 2 +- | |
M bin/werc.rc | 4 ++-- | |
M bin/werclib.rc | 2 +- | |
M etc/initrc | 3 +++ | |
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.… | |
* An http server that can handle CGIs | |
+* Plan 9 from User Space: http://plan9.us - Or 9base-5 or later: http://tools.… | |
+ | |
+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]+/[^/]+… | |
+wman_junk_filter='/(\/(INDEX|\.cvsignore|_.*)|\.9p|\.html)$/d; s!/man([0-9]+/[… | |
fn wman_ls_pages { | |
ls $* \ | |
| sed $dirfilter^$wman_junk_filter^' s/\.([0-9]|9p)$//; s!/0intro$!/in… | |
@@ -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 n… | |
+ 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 … | |
| 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="di… | |
# 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 '{… | |
+ ls -F $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean | awk '{… | |
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?)… | |
- # 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; … | |
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 w… | |
if(~ $"t '') | |
- t=`{sed -n -e 's/^(<[^>]+>)*([^<]+).*/\2/p; 32q' < $1 | sed 1q} | |
+ t=`{sed -n -e 's/^[ ]*(<[^>]+>)*([^<]+).*/\2/p; 32q' < $1 | se… | |
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 chan… | |
+# 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) |