Two new configuration options for wman:

* wman_tmac (defaults to 'an') to pass as parameter to the -m flag of troff.
* fn wman_out_filter (defaults to calling wman_default_out_filter) to do post-processing (eg., calling col) of man page output.

Also filter out directories starting with _ from man page section listings.
This commit is contained in:
Uriel 2011-01-09 10:48:18 +00:00
parent 488a431d11
commit 7327afab9d

View File

@ -1,4 +1,5 @@
fn conf_enable_wman { fn conf_enable_wman {
wman_tmac=an
wman_base_uri=$conf_wd wman_base_uri=$conf_wd
wman_man_path=$* wman_man_path=$*
if(~ $#wman_man_path 0) if(~ $#wman_man_path 0)
@ -6,7 +7,7 @@ fn conf_enable_wman {
conf_enable_app 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 { fn wman_ls_pages {
ls $* \ ls $* \
| sed $dirfilter^$wman_junk_filter^' s/\.([0-9]|9p)$//; s!/0intro$!/intro!' \ | 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 { fn wman_page_gen {
#troff -manhtml $1| troff2html -t 'Plan 9 from User Space' #troff -manhtml $1| troff2html -t 'Plan 9 from User Space'
troff -N -man $1 \ # Using GNU col here to remove nroffs garbage (eg., from .ft B); p9p has no col(1) :(
| escape_html \ 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' \ | 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}' | awk '/^$/ {if(n != 1) print; n=1; next} /./ {n=0; print}'
} }