Do not set handler if man page doesn't exist so we can provide proper 404 (or other fall-back)
Make 'Intro' page title fixing case-insensitive to deal with Plan B man pages.
This commit is contained in:
parent
7718328227
commit
9d7ac1c517
2 changed files with 14 additions and 9 deletions
|
|
@ -20,8 +20,17 @@ fn wman_init {
|
||||||
wman_cp='man'
|
wman_cp='man'
|
||||||
wman_pe=.^$"wman_cat
|
wman_pe=.^$"wman_cat
|
||||||
}
|
}
|
||||||
if(! ~ $"wman_cat '')
|
|
||||||
|
if(! ~ $"wman_cat '') {
|
||||||
wman_cat_path=$wman_man_path^/^$"wman_cp^$p(1)
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wman_cat_list=`{ls -F $wman_man_path/*/ \
|
wman_cat_list=`{ls -F $wman_man_path/*/ \
|
||||||
| sed -e $wman_junk_filter -e 's!.*/([^/]+)/[^/]+$!\1!; /[0-9]+/!d' \
|
| sed -e $wman_junk_filter -e 's!.*/([^/]+)/[^/]+$!\1!; /[0-9]+/!d' \
|
||||||
|
|
@ -34,7 +43,8 @@ fn wman_init {
|
||||||
if not if(~ $req_path $wman_base_uri^*) {
|
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])
|
#^*/[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(echo $req_path | grep -s '^'^$wman_base_uri^'/*[0-9]+/[0-9a-z\-\+\.]+$')
|
||||||
handler_body_main=(tpl_handler apps/wman/man_page.tpl)
|
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^*/)
|
if not if(~ $req_path $wman_base_uri^*/)
|
||||||
handler_body_main=(tpl_handler apps/wman/page_list.tpl)
|
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
|
if not if(~ $p(2) [A-Z]* [0-9][A-Z]*) # Correct badly capitalized links
|
||||||
|
|
@ -53,7 +63,7 @@ fn wman_init {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wman_get_section_desc {
|
fn wman_get_section_desc {
|
||||||
cat $wman_man_path/^$"wman_cp^$1/0intro* >[2]/dev/null| sed '1,2d; s!intro \\- introduction to !!; 3q;'
|
cat $wman_man_path/^$"wman_cp^$1/0intro* >[2]/dev/null| sed '1,2d; s!intro \\- [Ii]ntroduction to !!; 3q;'
|
||||||
}
|
}
|
||||||
|
|
||||||
fn wman_page_gen {
|
fn wman_page_gen {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,7 @@
|
||||||
<pre>
|
<pre>
|
||||||
%{
|
%{
|
||||||
|
|
||||||
# Hack to handle 0intro files.
|
wman_page_gen $wman_page_file
|
||||||
f=$wman_page^$"wman_pe
|
|
||||||
if(~ $wman_page intro && test -f $wman_cat_path^/0^$f)
|
|
||||||
f=0^$f
|
|
||||||
|
|
||||||
wman_page_gen $wman_cat_path^/^$f
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue