summaryrefslogtreecommitdiff
path: root/apps/wman
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2024-04-07 13:25:49 +0200
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2024-04-07 13:25:49 +0200
commit9cb56dabb676391a9382731347e8d2b07b9437a5 (patch)
tree95302f041497679202722d9896ec1386bed2d86c /apps/wman
parent0a37a1cc5909e11098963267edc9654b85e7ce16 (diff)
big cleanup
Diffstat (limited to 'apps/wman')
-rwxr-xr-xapps/wman/app.rc89
-rwxr-xr-xapps/wman/man_page.tpl3
-rwxr-xr-xapps/wman/page_list.tpl11
-rwxr-xr-xapps/wman/search.tpl20
-rwxr-xr-xapps/wman/section_list.tpl11
5 files changed, 0 insertions, 134 deletions
diff --git a/apps/wman/app.rc b/apps/wman/app.rc
deleted file mode 100755
index 8f0a150..0000000
--- a/apps/wman/app.rc
+++ /dev/null
@@ -1,89 +0,0 @@
-fn conf_enable_wman {
- wman_tmac=an
- wman_base_uri=$conf_wd
- wman_man_path=$*
- if(~ $#wman_man_path 0)
- wman_man_path=$wman_base_uri
- conf_enable_app wman
-}
-
-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!' \
- | sort -u
-}
-fn wman_init {
- ifs=$ifs^'/' { p=`{echo $req_path | sed 's!^'^$wman_base_uri^'!!'} }
- wman_cat=$p(1)
- wman_page=$p(2)
- if(~ $#wman_unix_mode 1) {
- wman_cp='man'
- wman_pe=.^$"wman_cat
- }
-
- if(! ~ $"wman_cat '') {
- wman_cat_path=$wman_man_path^/^$"wman_cp^$p(1)
- if(! ~ $"wman_page '') {
- wman_page_file=$wman_page^$"wman_pe
- # Hack to handle 0intro files.
- if(~ $wman_page intro && test -f $wman_cat_path^/0^$"wman_page_file)
- wman_page_file=0^$"wman_page_file
- wman_page_file=$wman_cat_path^/^$"wman_page_file
- x=`{echo $"req_path|sed 's%.*/([^/]+)/'$"wman_cat'/'^$"wman_page^'%\1%; s%_% %g'}
- pageTitle=$wman_page' page from Section '$wman_cat' of the '^$"x' manual'
- }
- }
-
- wman_cat_list=`{ls -F $wman_man_path/*/ \
- | sed -e $wman_junk_filter -e 's!.*/([^/]+)/[^/]+$!\1!; /[0-9]+/!d' \
- | sort -un}
-
- synth_paths=($wman_base_uri$wman_cat_list'/')
-
- if(~ $req_path $wman_base_uri && ~ $"handler_body_main '')
- handler_body_main=(tpl_handler apps/wman/section_list.tpl)
- if not if(~ $req_path $wman_base_uri^*) {
- #^*/[a-z0-9]*[a-z]* $wman_base_uri^*/*[a-z]*[a-z0-9] $wman_base_uri^*/[a-z])
- if(echo $req_path | grep -s '^'^$wman_base_uri^'/*[0-9]+/[0-9a-z\-\+\.]+$')
- if(test -f $wman_page_file) # Check for 404
- handler_body_main=(tpl_handler apps/wman/man_page.tpl)
- if not if(~ $req_path $wman_base_uri^*/)
- handler_body_main=(tpl_handler apps/wman/page_list.tpl)
- if not if(~ $p(2) [A-Z]* [0-9][A-Z]*) # Correct badly capitalized links
- perm_redirect $wman_base_uri^$p(1)^/^`{echo $p(2) |tr 'A-Z' 'a-z'}
- }
-
- # Search
- ll_add handlers_body_head tpl_handler apps/wman/search.tpl
- if(! ~ $"post_arg_wman_search '') {
- s=`{echo $post_arg_wman_search | sed 's/[^a-zA-Z0-9\-\.]+//g; s/\.+/./g; 1q'}
- ifs='' { wman_search_results=`{wman_ls_pages $wman_man_path/*/*^$"s^*} }
- if(! ~ $"post_arg_go '' && ~ `{echo -n $wman_search_results|wc -l} 1)
- post_redirect $wman_base_uri^`{echo $wman_search_results|awk -F/ '{print $(NF-1)"/"$NF}'}
- }
-
-}
-
-fn wman_get_section_desc {
- cat $wman_man_path/^$"wman_cp^$1/0intro* >[2]/dev/null| sed '1,2d; s!intro \\- [Ii]ntroduction to !!; 3q;'
-}
-
-fn wman_page_gen {
- #troff -manhtml $1| troff2html -t 'Plan 9 from User Space'
- troff -N -m$wman_tmac $1 | wman_out_filter
-}
-
-fn wman_out_filter {
- wman_default_out_filter
-}
-
-fn wman_default_out_filter {
- # col -x syntax is the same for UNIX and Plan 9.
- 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}' \
- | col -x
-}
-
-
diff --git a/apps/wman/man_page.tpl b/apps/wman/man_page.tpl
deleted file mode 100755
index 945e23a..0000000
--- a/apps/wman/man_page.tpl
+++ /dev/null
@@ -1,3 +0,0 @@
-<pre>
-% wman_page_gen $wman_page_file
-</pre>
diff --git a/apps/wman/page_list.tpl b/apps/wman/page_list.tpl
deleted file mode 100755
index b98600d..0000000
--- a/apps/wman/page_list.tpl
+++ /dev/null
@@ -1,11 +0,0 @@
-% d=`{wman_get_section_desc $wman_cat}
-<h1>Manual pages - Section %($wman_cat%): %($"d%)</h1>
-
-<ul style="float:left">
-%{
-wman_ls_pages $wman_cat_path \
- | awk -F/ '{ print "<li><a href=\""$(NF)"\">"$(NF)"</a></li>" }
- NR%20 == 0 { print "</ul><ul style=\"float: left\">" }'
-%}
-</ul>
-
diff --git a/apps/wman/search.tpl b/apps/wman/search.tpl
deleted file mode 100755
index a6c59e4..0000000
--- a/apps/wman/search.tpl
+++ /dev/null
@@ -1,20 +0,0 @@
-<form action="" method="POST">
-<fieldset>
- <input type="text" name="wman_search" value="%($"s%)" />
- <input type="submit" name="go" value="Feel Lucky" />
- <input type="submit" value="Search" />
-
-% if(! ~ $"post_arg_wman_search '') {
-% if(~ $"wman_search_results '') {
- No matches found for <i>'%($post_arg_wman_search%)'</i>.
-% }
-% if not {
- <ul>
-% echo $wman_search_results|awk -F/ '$(NF-1) ~ "^[0-9]+$" {printf "<li><a href=\"'$wman_base_uri'%s/%s\" />%s(%s)</a></li>", $(NF-1),$NF, $NF, $(NF-1)}'
- </ul>
-% }
-% }
-
-</fieldset>
-</form>
-
diff --git a/apps/wman/section_list.tpl b/apps/wman/section_list.tpl
deleted file mode 100755
index 299d613..0000000
--- a/apps/wman/section_list.tpl
+++ /dev/null
@@ -1,11 +0,0 @@
-<h1>Manual Sections</h1>
-
-<ul style="text-transform: capitalize;">
-% for(c in $wman_cat_list) {
- <li><a href="%($c%)/"><b>Section: %($c%)</b></a>
-% wman_get_section_desc $c
-% if(~ $status '' '|')
-% echo '(<a href="'$c'/intro">intro</a>)'
- </li>
-% }
-</ul>