Make coding style more consistent.
This commit is contained in:
parent
6095d57ab8
commit
abb5df1d32
@ -215,7 +215,6 @@ fn auth_user {
|
||||
|
||||
|
||||
# Blog stuff
|
||||
|
||||
fn make_blog_post {
|
||||
bdir=$1
|
||||
btitle=$2
|
||||
@ -280,7 +279,6 @@ fn select_apps {
|
||||
|
||||
fn app_handler {
|
||||
$app_body_handler
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
26
bin/werc.rc
26
bin/werc.rc
@ -94,7 +94,7 @@ fn dir_listing_handler {
|
||||
d=`{basename -d $1}
|
||||
echo $d|sed 's,.*//,,g; s,/$,,; 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 $d/. | sed -e 's/\*$//; '^$dirfilter' s,.*/([^/]+/?)$,<li><a href="\1">\1</a></li>,'
|
||||
ls -F $d/. | sed 's/\*$//; '^$dirfilter' s,.*/([^/]+/?)$,<li><a href="\1">\1</a></li>,'
|
||||
echo '</ul>'
|
||||
}
|
||||
|
||||
@ -154,21 +154,18 @@ fn select_handler {
|
||||
|
||||
# Rss feeds. TODO: we should check that the request is for a real blog dir
|
||||
if not if(~ $REQUEST_URI */index.rss */index.atom) {
|
||||
response_format=raw
|
||||
uri=`{echo $uri | sed 's/index.(rss|atom)$//'}
|
||||
if(~ $#blogDirs 0)
|
||||
blogDirs=$sitedir^'/'$uri
|
||||
uri=$baseuri$"uri
|
||||
|
||||
if (~ $REQUEST_URI */index.rss) {
|
||||
if(~ $REQUEST_URI */index.rss)
|
||||
master_template=feeds/rss20.tpl
|
||||
}
|
||||
if not if (~ $REQUEST_URI */index.atom) {
|
||||
if not if(~ $REQUEST_URI */index.atom)
|
||||
master_template=feeds/atom.tpl
|
||||
}
|
||||
|
||||
response_format=raw
|
||||
}
|
||||
|
||||
# Blog handler
|
||||
if not if(~ $body */[bB]log/index */[bB]log//index || ! ~ $#blogDirs 0) {
|
||||
if(~ $#blogDirs 0)
|
||||
@ -177,9 +174,7 @@ fn select_handler {
|
||||
u=`{cleanname $baseuri^`{basename -d '/'^$uri}|sed 's,:/,://,'} # Sed recovers '/' in 'http:/' stripped by cleanname
|
||||
extraHeaders=$"extraHeaders ^ \
|
||||
'<link rel="alternate" type="application/rss+xml" title="RSS" href="'$"u'/index.rss" />
|
||||
<link rel="alternate" type="application/atom+xml" title="ATOM" href="'$"u'/index.atom" />
|
||||
|
||||
'
|
||||
<link rel="alternate" type="application/atom+xml" title="ATOM" href="'$"u'/index.atom" />'
|
||||
set_handler tpl_handler lib/feeds/html.tpl
|
||||
}
|
||||
|
||||
@ -207,11 +202,7 @@ fn select_handler {
|
||||
|
||||
}
|
||||
|
||||
|
||||
fn genbody {
|
||||
$handler $handler_args
|
||||
}
|
||||
|
||||
fn genbody { $handler $handler_args }
|
||||
|
||||
# Careful, the proper p9p path might not be set until initrc.local is sourced
|
||||
path=(. $PLAN9/bin ./bin/ /bin/ /usr/bin)
|
||||
@ -257,6 +248,7 @@ if not {
|
||||
|
||||
fpath=$sitedir
|
||||
for(i in ('' $args)) {
|
||||
# TODO We can build a list of paths here that can be used in sidebar, instead of iterating args twice
|
||||
fpath=$fpath/$i
|
||||
# We don't want blog settings to cascade into posts, note that we are inBlog instead
|
||||
if(! ~ $#blogDirs 0 && ! ~ $req_path */index.rss */index.atom */[bB]log */[bB]log/) {
|
||||
@ -277,7 +269,6 @@ if (~ $#redirectPermanent 1)
|
||||
|
||||
if not if(~ $#redirectPermanent 2 && {echo $SERVER_NAME^$REQUEST_URI|grep -s $redirectPermanent(1) }) {
|
||||
# Experimental regexp sub-based redirect, probably should find a nicer interface
|
||||
# For now only used at sites/harmful.cat-v.org/software/OO_programming/_werc/config
|
||||
to=`{echo $SERVER_NAME^$REQUEST_URI|sed 's@'^$redirectPermanent(1)^'@'^$redirectPermanent(2)^'@'}
|
||||
if(! ~ $to $REQUEST_URI)
|
||||
perm_redirect $to
|
||||
@ -309,6 +300,5 @@ if(~ $response_format html) {
|
||||
template $headers $master_template | awk_buffer
|
||||
echo '</body></html>'
|
||||
}
|
||||
if not if (~ $response_format raw) {
|
||||
if not if(~ $response_format raw)
|
||||
template < $master_template
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user