swerc

anselm's simpler werc fork
git clone git://git.suckless.org/swerc
Log | Files | Refs | README

commit 2e3041676a90f105a3c9162c8ce7d04413383b16
parent 8d6768666f215fe98ffbde88bdd1b0ee00de5b96
Author: anselm@garbe.us <unknown>
Date:   Sat, 11 Feb 2012 18:56:43 +0100

removed useless apps
Diffstat:
Dapps/blagh/app.rc | 139-------------------------------------------------------------------------------
Dapps/blagh/atom.tpl | 139-------------------------------------------------------------------------------
Dapps/blagh/convert.rc | 20--------------------
Dapps/blagh/new_post.tpl | 11-----------
Dapps/blagh/rss20.tpl | 52----------------------------------------------------
Dapps/bridge/app.rc | 103-------------------------------------------------------------------------------
Dapps/bridge/comments_list.tpl | 13-------------
Dapps/bridge/foot.tpl | 37-------------------------------------
Dapps/dirdir/app.rc | 40----------------------------------------
Dapps/dirdir/edit.tpl | 25-------------------------
Dapps/dirdir/sidebar_controls.tpl | 3---
Dapps/hello/app.rc | 10----------
Dapps/wman/app.rc | 89-------------------------------------------------------------------------------
Dapps/wman/man_page.tpl | 7-------
Dapps/wman/page_list.tpl | 11-----------
Dapps/wman/search.tpl | 20--------------------
Dapps/wman/section_list.tpl | 11-----------
17 files changed, 0 insertions(+), 730 deletions(-)

diff --git a/apps/blagh/app.rc b/apps/blagh/app.rc @@ -1,139 +0,0 @@ -fn conf_enable_blog { - blagh_uri=$conf_wd - blagh_dirs=$* - if(~ $#blagh_dirs 0) - blagh_dirs=( . ) - conf_enable_app blagh - - if(~ $"conf_blog_editors '') - conf_blog_editors=blog-editors - - if(~ $"conf_max_posts_per_page '') - conf_max_posts_per_page=32 -} - -fn blagh_init { - if(~ $#blagh_dirs 0 && ~ $req_path */[bB]log/*) { - blagh_uri=`{echo $req_path | sed 's,(/[bB]log/).*,\1,'} - blagh_dirs=( . ) - } - - # Should not match sub-dirs! - if(! ~ $#blagh_dirs 0) { - # && test -d / `{echo '-a -d '^$blagh_root^$blagh_dirs} - blagh_url=$base_url^$blagh_uri - blagh_root=$sitedir^$blagh_uri - if(check_user $conf_blog_editors) { - editor_mode=on - if(~ $"post_arg_date '') - post_date=`{/bin/date +%F|sed 's,-,/,g'} - if not - post_date=$post_arg_date - ll_add handlers_bar_left echo '<a href="'$blagh_uri'new_post">Make a new post</a>' - } - - if(~ $req_path $blagh_uri) { - handler_body_main=blagh_body - u=$blagh_uri'index' - extraHeaders=$"extraHeaders ^ \ -'<link rel="alternate" type="application/atom+xml" title="ATOM" href="'$"u'.atom" /> -<link rel="alternate" type="application/rss+xml" title="RSS" href="'$"u'.rss" />' - } - if not if(~ $req_path $blagh_uri^index.atom) - blagh_setup_feed_handlers atom.tpl 'application/atom+xml' - - if not if(~ $req_path $blagh_uri^index.rss) - blagh_setup_feed_handlers rss20.tpl 'text/xml; charset=utf-8' - - if not if(~ $req_path $blagh_uri^new_post && ! ~ $#editor_mode 0) { - handler_body_main=( tpl_handler `{get_lib_file blagh/new_post.tpl apps/blagh/new_post.tpl} ) - if(~ $REQUEST_METHOD POST) { - if(mkbpost $"post_arg_body $"post_date $"post_arg_title $post_arg_id) - post_redirect $blagh_uri - if not - notify_errors=$status - } - } - - } -} - -fn blagh_setup_feed_handlers { - handler_body_main=NOT_USED_by_blagh_feeds - res_tail=() - http_content_type=$2 - headers=() - master_template=apps/blagh/$1 # Should we allow tempalte override? -} - -fn blagh_body { - if (! ~ $"blogTitle '') - echo '<h1>'$"blogTitle'</h1>' - - # Direct links to feeds are disabled because they are not very useful, add clutter and might waste pagerank. - # An user can add this on their own using handlers_body_head anyway. - #echo '<div style="text-align:right">(<a href="index.rss">RSS Feed</a>|<a href="index.atom">Atom Feed</a>)</div>' - - { # XXX Not sure why this fixes issues with blog setup, probably bug in fltr_cache! - for(p in `{get_post_list $blagh_root^$blagh_dirs}) { - l=`{echo -n $p|sed 's!'$sitedir^'/?(.*)([0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])(/[^/]+/)!\2 /\1\2\3!'} - sed '1s!.*![&]('^$l(2)^') ('^$l(1)^')!' < $p/index.md - echo # Needed extra \n so markdown doesn't mess up the formatting, probably can be done in sed. - } - # XXX BUG! Markdown [references] break because multiple markdown documents are merged. Should format each blog post independently. - # TODO: use fltr_cache directly, that can fix the previous bug plus provide a perf boost by caching title generation. - } | $formatter -} - -fn get_post_list { - # /./->/|/ done to sort -t| and order by date - # Note: $paths in blagh_dirs should not contain '/./' or '|' - ls -F $*^/./[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/ >[2]/dev/null | sed -n '/'^$forbidden_uri_chars^'/d; s,/\./,/|/,; /\/$/p' | sort -r '-t|' +1 | sed -e 's,/+\|/+,/,' -e $conf_max_posts_per_page^'q' -} - -fn mkbpost { - bptext=$1 - bpdate=$2 - bptitle=$3 - bpid=$4 - _status=() - if(~ $"bptext '') - _status=($_status 'You need to provide a post body.') - if(! ~ $"bpdate [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]) - _status=($_status 'Invalid date: '''^$"bpdate^'''') # XXX Should make semantic check. - - if(~ $#_status 0) { - umask 002 # Let group write - if(! ~ $"bpid '') - bpid=`{echo -n '-'^$bpid | sed 's/'$forbidden_uri_chars'+/_/g; 1q'} - - ddir=$blagh_root^$bpdate^'/' - n=`{ls $ddir >[2]/dev/null |wc -l} - - mkdir -p $ddir/$"n^$"bpid/ - { - if(! ~ $"bptitle '') { - echo $bptitle - echo '=========================================' - } - # TODO: Enable metadata - #echo '* Posted:' `{date} - #if(! ~ $#logged_user 0) - # echo '* Author: '$logged_user - echo - echo $bptext - }> $ddir/$"n^$"bpid/index.md - - # Experimental support for http://pubsubhubbub.googlecode.com/ - if(! ~ $"conf_blog_pubsubdub_hub '') { - ifs='' { p=`{echo $req_url|sed 's/new_post$/index.atom/'|url_encode } } - dprint hget -p 'hub.mode=publish&hub.url='^$"p $conf_blog_pubsubdub_hub - hget -d -h -p 'hub.mode=publish&hub.url='^$"p $conf_blog_pubsubdub_hub >[1=2] & - } - } - status=$_status -} - -fn strip_title_from_md_file { - sed '1N; /^.*\n===*$/N; /.*\n===*\n$/d' -} diff --git a/apps/blagh/atom.tpl b/apps/blagh/atom.tpl @@ -1,139 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -%{ -# See for more info:http://www.tbray.org/ongoing/When/200x/2005/07/27/Atomic-RSS -fn statpost { - f = $1 - - updated = `{/bin/date --rfc-3339'=seconds' -r $f |tr ' ' 'T'} - post_uri=$base_url^`{cleanname `{echo $f | sed -e 's!^'$sitedir'!!'}}^'/' - title=`{read $f/index.md} - # Not used: date=`{/bin/date -Rd `{basename $f |sed 's/(^[0-9\-]*).*/\1/; s/-[0-9]$//'}} - # TODO: use mtime(1) and ls(1) instead of lunix's stat(1) - stat=`{stat -c '%Y %U' $f} - #mdate=`{/bin/date -Rd `{mtime $f|awk '{print $1}' }} # Not used because it is unreliable - by=$stat(2) - #ifs=() { summary=`{cat $f/index.md | crop_text 1024 ... | $formatter } } - ifs=() { summary=`{cat $f/index.md | strip_title_from_md_file | ifs=$difs {$formatter} } } -} -updated = `{/bin/date --rfc-3339'=seconds' |sed 's/ /T/'} -%} - -<feed xmlns="http://www.w3.org/2005/Atom" - xmlns:thr="http://purl.org/syndication/thread/1.0"> - -% if(! ~ $"conf_blog_pubsubdub_hub '') { -% echo '<link rel="hub" href="'$conf_blog_pubsubdub_hub'" />' -% } - - <link rel="self" href="%($base_url^$req_path%)"/> - <id>%($base_url^$req_path%)</id> - <icon>/favicon.ico</icon> - - <title>%($siteTitle%)</title> - <subtitle>%($siteSubTitle%)</subtitle> - -% # <updated>2008-09-24T12:47:00-04:00</updated> - <updated>%($updated%)</updated> - <link href="."/> - -% for(f in `{get_post_list $blagh_root$blagh_dirs}) { -% statpost $f - - <entry> -% # Maybe we should be smarter, see: http://diveintomark.org/archives/2004/05/28/howto-atom-id, example: <id>tag:intertwingly.net,2004:2899</id> - <id>%($post_uri%)</id> - <link href="%($post_uri%)"/> - <title>%($title%)</title> -% # <link rel="replies" href="2899.atom" thr:count="0"/> - <author><name>%($by%)</name></author> - - - <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"> - %($summary%) - </div></content> - - <updated>%($updated%)</updated> - </entry> - -% } - -</feed> - -% exit - -<feed xmlns="http://www.w3.org/2005/Atom" - xmlns:thr="http://purl.org/syndication/thread/1.0"> - <link rel="self" href="http://intertwingly.net/blog/index.atom"/> - <id>http://intertwingly.net/blog/index.atom</id> - <icon>../favicon.ico</icon> - - <title>Sam Ruby</title> - <subtitle>It’s just data</subtitle> - <author> - <name>Sam Ruby</name> - <email>rubys@intertwingly.net</email> - <uri>/blog/</uri> - </author> - <updated>2008-09-24T12:47:00-04:00</updated> - <link href="/blog/"/> - <link rel="license" href="http://creativecommons.org/licenses/BSD/"/> - - <entry> - <id>tag:intertwingly.net,2004:2899</id> - <link href="/blog/2008/09/11/RubyConf-2008"/> - <link rel="replies" href="2899.atom" thr:count="0"/> - <title>RubyConf 2008</title> - <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"> - -<p>My <a href="http://www.rubyconf.org/talks/14">proposal</a> has been accepted for <a href="http://www.rubyconf.org/talks">RubyConf 2008</a>.  Because of the presence of Ruby implementers, this is going to be a bit challenging as it will likely turn into two talks at once.  One sharing experiences with fellow developers concerning things they may need to watch out for, and another with language designers about the impact of their changes.  It also is likely to be true, as it was at <a href="http://intertwingly.net/blog/2008/07/24/Ruby-1-9-What-to-Expect">OSCON</a>, that there will be members of the audience who know way more about this subject than I do.</p> -<p>I had originally requested a slot on Saturday.  My current slot requires me to shave a day off of <a href="http://us.apachecon.com/c/acus2008/">ApacheCon</a>.  I’ve again asked that the slot be changed, but even if it doesn’t move, I can manage this.  At least we are only talking about a short hop from New Orleans to Orlando.</p> - - </div></content> - <updated>2008-09-11T06:51:36-04:00</updated> - </entry> - - <entry> - <id>tag:intertwingly.net,2004:2898</id> - <link href="/blog/2008/09/10/Small-Updates"/> - <link rel="replies" href="2898.atom" thr:count="8" thr:updated="2008-09-10T15:31:05-04:00"/> - <title>Small Updates</title> - <summary type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"> - - <p><a href="http://hublog.hubmed.org/archives/001744.html">Alf Eaton</a>: <em>Aside: if you’re reading a Planet that contains HubLog, those posts will all jump to the top - sorry! (I wish Planets dealt better with small updates so I didn’t have to worry about it).</em></p> -<p>I don’t know what publishing software you use, but I see you provide an Atom feed, and Planet 2.0 and Venus both implement <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php#element.updated">atom:updated</a> as specified in RFC 4287.</p> - - </div></summary> - <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"> - -<p><a href="http://hublog.hubmed.org/archives/001744.html"><cite>Alf Eaton</cite></a>: <em>Aside: if you’re reading a Planet that contains HubLog, those posts will all jump to the top - sorry! (I wish Planets dealt better with small updates so I didn’t have to worry about it).</em></p> -<p>I don’t know what publishing software you use, but I see you provide an Atom feed, and Planet 2.0 and Venus both implement <a href="http://www.atomenabled.org/developers/syndication/atom-format-spec.php#element.updated">atom:updated</a> as specified in RFC 4287.</p> -<p>More specifically, if you have a minor update and leave the updated date alone, the posts will not jump to the top.  The next release of WordPress, for example, will contain the necessary hooks for a <a href="http://blog.ciarang.com/posts/wp-minor-edit/">plugin</a> to provide a simple checkbox for indicating that the change constitutes a minor edit.</p> - - </div></content> - <updated>2008-09-10T10:18:47-04:00</updated> - </entry> - - <entry> - <id>tag:intertwingly.net,2004:2897</id> - <link href="/blog/2008/09/07/SVG-via-CSS"/> - <link rel="replies" href="2897.atom" thr:count="10" thr:updated="2008-09-12T02:21:21-04:00"/> - <title>SVG via CSS</title> - <summary type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"> - - <p>Now that I have my weblog looking reasonably consistent between Gecko and WebKit based browsers, I’ve taken another look at Opera.  Opera doesn’t have support for border-radius, but does have support for background images in SVG, which can be <a href="http://dev.opera.com/articles/view/new-development-techniques-using-opera-k/">used to provide the same effect</a>.  My Nav Bar on <a href="http://rails.intertwingly.net/blog/">my test site</a> now employs this technique, and it requires two separate images: <a href="http://rails.intertwingly.net/stylesheets/rc-039-CCD.svg">039 on CCD</a> and <a href="http://rails.intertwingly.net/stylesheets/rc-CCD-FFF.svg">CCD on FFF</a>.</p> -<p>Frankly, my first reaction to this was mixed.  The pluses for SVG in CSS is that it doesn’t require either adjusting your markup or JavaScript to achieve these effects, a desirable characteristic that generally the <a href="http://www.cssjuice.com/25-rounded-corners-techniques-with-css/">other techniques</a> don’t share.</p> - - </div></summary> - - <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"> - -<p>Now that I have my weblog looking reasonably consistent between Gecko and WebKit based browsers, I’ve taken another look at Opera.  Opera doesn’t have support for border-radius, but does have support for background images in SVG, which can be <a href="http://dev.opera.com/articles/view/new-development-techniques-using-opera-k/">used to provide the same effect</a>.  My Nav Bar on <a href="http://rails.intertwingly.net/blog/">my test site</a> now employs this technique, and it requires two separate images: <a href="http://rails.intertwingly.net/stylesheets/rc-039-CCD.svg">039 on CCD</a> and <a href="http://rails.intertwingly.net/stylesheets/rc-CCD-FFF.svg">CCD on FFF</a>.</p> -<p>Meanwhile, Robert O’Callahan has been exploring <a href="http://weblogs.mozillazine.org/roc/archives/2008/06/applying_svg_ef.html">other ways</a> to integrate these technologies.</p> - - </div></content> - <updated>2008-09-07T11:12:29-04:00</updated> - </entry> - -</feed> - diff --git a/apps/blagh/convert.rc b/apps/blagh/convert.rc @@ -1,20 +0,0 @@ -#!/usr/bin/env rc - -path=($PLAN9/bin/ $path) - -for(p in *.md) { - echo - echo '=========================' - echo p $p - pp=`{echo $p | sed 's/^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])[\-_](.*).md$/\1 \2 \3 \4/' } - echo pp $pp - - d=$pp(1)^'/'^$pp(2)^'/'^$pp(3)^'/'^$pp(4)^'/' - - mkdir -p $d - echo $pp(4) | sed -e 's/^[0-9]_//; s/_/ /g;' > $d/index.md - echo '=================================' >> $d/index.md - echo >> $d/index.md - cat $p >> $d/index.md - -} diff --git a/apps/blagh/new_post.tpl b/apps/blagh/new_post.tpl @@ -1,11 +0,0 @@ -<div> -% notices_handler -<form method="POST"><fieldset> - <legend>Submit a new blog post</legend> - <textarea cols="94" rows=16" name="body">%($"post_arg_body%)</textarea><br /> - <label>Title: <input size="64" type="text" name="title" value="%($"post_arg_title%)" /></label> - <label>Id: <input size="8" type="text" name="id" value="%($"post_arg_id%)" /></label> - <label>Date: <input size="10" maxlength="10" type="text" name="date" value="%($"post_date%)" /></label> - <input type="submit" value="Post" /> -</fieldset></form> -</div> diff --git a/apps/blagh/rss20.tpl b/apps/blagh/rss20.tpl @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -%{ -fn statpost { - f = $1 - - post_uri = `{echo $f | sed 's,^'$sitedir',,'} - #title=`{basename $f | sed 's/^[0-9\-]*_(.*)\.md$/\1/; s/_/ /g' } - title=`{read $f/index.md} - date=`{/bin/date -Rd `{echo $f|sed 's,.*/([0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])/.*,\1,'}} - # TODO: use mtime(1) and ls(1) instead of lunix's stat(1) - stat=`{stat -c '%Y %U' $f} - #mdate=`{/bin/date -Rd $stat(1)} # Not used because it is unreliable - post_uri=$base_url^`{cleanname `{echo $f | sed -e 's!^'$sitedir'!!'}}^'/' - by=$stat(2) - ifs=() {summary=`{ cat $f/index.md |strip_title_from_md_file| ifs=$difs {$formatter | escape_html} }} -} - -%} - -<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> - <channel> - <atom:link href="%($base_url^$req_path%)" rel="self" type="application/rss+xml" /> - <title>%($siteTitle%)</title> - <link>%($base_url^$req_path%)</link> - <description>%($blogDesc%)</description> - <language>en-us</language> - <generator>Tom Duff's rc, and Kris Maglione's clever hackery</generator> -%{ - # <webMaster>uriel99+rss@gmail.com (Uriel)</webMaster> - for(f in `{get_post_list $blagh_root$blagh_dirs}) { - statpost $f - # Hack to aproximate the last build date - #(use the mdate from last posted item) - # Commented out for now because maybe a wrong value is worse than no value - #if(~ $#last_build_date 0) { - #last_build_date='<lastBuildDate>'^$"mdate'</lastBuildDate>' - #echo $last_build_date - #} -%} - <item> - <title>%($title%)</title> - <author>%($by%)@noreply.cat-v.org (%($by%))</author> - <link>%($post_uri%)</link> - <guid isPermaLink="true">%($post_uri%)</guid> - <pubDate>%($date%)</pubDate> - <description>%($summary%)</description> - </item> -% } - - </channel> -</rss> diff --git a/apps/bridge/app.rc b/apps/bridge/app.rc @@ -1,103 +0,0 @@ -comment_file_types=(md html) - -fn conf_enable_comments { - if(~ $1 -n) { - allow_new_user_comments=yes - shift - } - if not if(~ $1 -a) { - bridge_anon_comments=yes - } - enable_comments=yes - groups_allowed_comments=$* - conf_enable_app bridge -} - -fn bridge_init { - if(~ $#enable_comments 1 && ! ~ `{ls $local_path.$comment_file_types >[2]/dev/null|wc -l} 0) { - - comments_dir=$sitedir$req_path'_werc/comments' - if(~ $REQUEST_METHOD GET && test -d $comments_dir) - ll_add handlers_body_foot template apps/bridge/comments_list.tpl - - if(check_user $groups_allowed_comments || {~ $#logged_user 0 && ~ 1 $#allow_new_user_comments $#bridge_anon_comments}) { - - if(~ $#post_arg_bridge_post 1) { - ll_add handlers_body_foot template apps/bridge/foot.tpl - - if(mk_new_comment $comments_dir) - post_redirect $base_url^$req_path - if not - saved_comment_text=$post_arg_comment_text - } - if not if(~ $REQUEST_METHOD GET) - ll_add handlers_body_foot template apps/bridge/foot.tpl - } - if not if(~ $REQUEST_METHOD GET) - ll_add handlers_body_foot echo '<hr><p>To post a comment you need to <a href="/_users/login">login</a> first.</p>' - } -} - -fn validate_new_user { - usr=$1; pass=$2; pass2=$3 - _status=() - - if(~ $"usr '' || ! echo $usr |sed 1q|grep -s '^'$allowed_user_chars'+$') - _status='Requested user name is invalid, must match: '^$allowed_user_chars^'+' - if not if(test -d etc/users/$usr) - _status='Sorry, user name '''^$usr^''' already taken, please pick a different one.' - - if(~ $"pass '' || ! ~ $"pass $"pass2) - _status=($_status 'Provided passwords don''t match.') - - status=$_status -} - - -fn mk_new_comment { - _status=() - dir=$1 - if(~ $"post_arg_comment_text '') - _status='Provide a comment!' - if not if(~ $#logged_user 0) { - if(! ~ $#allow_new_user_comments 0) { - if(validate_new_user $"post_arg_comment_user $post_arg_comment_passwd $post_arg_comment_passwd2) { - u=$post_arg_comment_user':'$post_arg_comment_passwd - dir=$comments_dir^'_pending' - # XXX: This doesn't work because we then do a redirect. - notify_notes='Saved comment and registration info, they will be enabled when approved by an admin.' - } - if not - _status=$status - } - if not if(! ~ $#bridge_anon_comments 0) { - if(~ $"post_arg_ima_robot 'not') - u='Glenda' # Anonymous - if not - _status='You are a robot!' - } - if not - _status='You need to log in to comment.' - } - if not if(check_user $groups_allowed_comments) - u=$logged_user - if not - _status='You are not a member of a group allowed to comment.' - - if(~ $#_status 0) { - umask 002 - - dir=$dir'/'`{date -n} # FIXME Obvious race - mkdir -m 775 -p $dir && - echo $u > $dir/user && - echo $current_date_time > $dir/posted && - echo $post_arg_comment_text > $dir/body - _s=$status - if(! ~ $"_s '') { - dprint 'ERROR XXX: Could not create comment: ' $_s - _status='Could not post comment due internal error, sorry.' - } - } - notify_errors=$_status - status=$_status -} diff --git a/apps/bridge/comments_list.tpl b/apps/bridge/comments_list.tpl @@ -1,13 +0,0 @@ -<hr> -<h2>Comments</h2> - -% for(c in `{ls $comments_dir/}) { -% if(test -s $c/body) { - <div class="comment"> - <h5>By: <i>%(`{cat $c/user}%)</i></b> (%(`{cat $c/posted}%)) - </h5> -% cat $c/body | escape_html | sed 's,$,<br>,' - <hr></div> -% } -% } - diff --git a/apps/bridge/foot.tpl b/apps/bridge/foot.tpl @@ -1,37 +0,0 @@ -<hr> - -% notices_handler -<form action="" method="post"> - <textarea name="comment_text" id="comment_text" cols="80" rows="16">%($"saved_comment_text%)</textarea> - <br> - <input type="submit" name="bridge_post" value="Post a comment"> - -% if(~ $#logged_user 0) { -% if(~ $#allow_new_user_comments 1) { - <label>New user name: - <input type="text" name="comment_user" value="%($"post_arg_comment_user%)"> - </label> - - <label>Password: - <input type="password" name="comment_passwd" value=""> - </label> - - <label>Repeat password: - <input type="password" name="comment_passwd2" value=""> - </label> - <div style="font-size: 70%"> - Enter your desired user name/password and after your comment has been reviewed by an admin it will be posted and your account will be enabled. If you are already registered please <a href="/_users/login">login</a> before posting. - </div> -% } -% if not if(~ $#bridge_anon_comments 1) { - <label>Is <a href="http://glenda.cat-v.org">Glenda a cute bunny</a>? - <select name='ima_robot'> - <option value="yes">No</option> - <option value="not">Yes</option> - <option value="foobar">I hate bunnies!</option> - <option value="robot">I'm a robot!</option> - </select> - </label> -% } -% } -</form> diff --git a/apps/dirdir/app.rc b/apps/dirdir/app.rc @@ -1,40 +0,0 @@ -fn conf_enable_wiki { - enable_wiki=yes - wiki_editors_groups=$* - conf_enable_app dirdir -} - -fn dirdir_init { - if(! ~ $#enable_wiki 0 && check_user $wiki_editors_groups) { - lp=$local_path - # werc.rc doesn't append /index when $local_path doesn't exit - # maybe it should, but for now we can fix it up here. - if(~ $lp */) - lp=$lp^'index' - dirdir_file=$lp.md - dirdir_dir=$dirdir_file^'_werc/dirdir/' - - if(~ 1 $#post_arg_dirdir_edit $#post_arg_dirdir_preview) - handler_body_main=(tpl_handler `{get_lib_file dirdir/edit.tpl apps/dirdir/edit.tpl}) - - if not if(! ~ '' $"post_arg_dirdir_save $"post_arg_edit_text) - save_page - - if not if(~ $"handler_body_main '' || {~ $REQUEST_METHOD GET && test -f $local_path.md}) - ll_add handlers_bar_left tpl_handler apps/dirdir/sidebar_controls.tpl - } -} - -fn save_page { - dirdir_verdir=$dirdir_dir/^`{date -n}^/ - mkdir -p $dirdir_verdir - umask 002 - - # XXX Use a tmp file and mv(1) to ensure updates are atomic? - echo $logged_user > $dirdir_verdir/author - echo $post_arg_edit_text > $dirdir_verdir/data - echo $post_arg_edit_text > $dirdir_file - - post_redirect $base_url^$req_path - #notify_notes='Saved <a href="'$"req_path'">'$"req_path'</a>!' -} diff --git a/apps/dirdir/edit.tpl b/apps/dirdir/edit.tpl @@ -1,25 +0,0 @@ -<div> - <h1>Editing: <a href="%($req_path%)">%($req_path%)</a></h1> - <br> - <form action="" method="POST"> - <textarea name="edit_text" id="edit_text" cols="80" rows="43">%{ -# FIXME Extra trailing new lines get added to the content somehow, should avoid it. - if(~ $#post_arg_edit_text 0 && test -f $dirdir_file) - cat $dirdir_file | escape_html - if not - echo -n $post_arg_edit_text | escape_html - - %}</textarea> - <br> - <input type="submit" name="dirdir_save" value="Save"> - <input type="submit" name="dirdir_preview" value="Preview"> - <small>DirDir documents are written using <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a>.</small> - </form> -</div> - -% if(! ~ $"post_arg_dirdir_preview '') { - <h2>Preview:</h2> - <div id="preview"> -% echo $post_arg_edit_text | $formatter - </div> -% } diff --git a/apps/dirdir/sidebar_controls.tpl b/apps/dirdir/sidebar_controls.tpl @@ -1,3 +0,0 @@ -<form action="" method="POST"> -<input type="submit" name="dirdir_edit" value="Edit page" /> -</form> diff --git a/apps/hello/app.rc b/apps/hello/app.rc @@ -1,10 +0,0 @@ -fn hello_init { - if(~ $req_path /hello) { - handler_body_main='hello_body' - pageTitle='Hi title!' - } -} - -fn hello_body { - echo 'Hello world!' -} diff --git a/apps/wman/app.rc b/apps/wman/app.rc @@ -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' - # Using GNU col here to remove nroffs garbage (eg., from .ft B); p9p has no col(1) :( - 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' \ - | awk '/^$/ {if(n != 1) print; n=1; next} /./ {n=0; print}' - -} - - diff --git a/apps/wman/man_page.tpl b/apps/wman/man_page.tpl @@ -1,7 +0,0 @@ -<pre> -%{ - -wman_page_gen $wman_page_file - -%} -</pre> diff --git a/apps/wman/page_list.tpl b/apps/wman/page_list.tpl @@ -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 @@ -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 @@ -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>