removed useless apps - swerc - anselm's simpler werc fork | |
git clone git://git.suckless.org/swerc | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 2e3041676a90f105a3c9162c8ce7d04413383b16 | |
parent 8d6768666f215fe98ffbde88bdd1b0ee00de5b96 | |
Author: [email protected] <unknown> | |
Date: Sat, 11 Feb 2012 18:56:43 +0100 | |
removed useless apps | |
Diffstat: | |
D apps/blagh/app.rc | 139 ------------------------------ | |
D apps/blagh/atom.tpl | 139 ------------------------------ | |
D apps/blagh/convert.rc | 20 -------------------- | |
D apps/blagh/new_post.tpl | 11 ----------- | |
D apps/blagh/rss20.tpl | 52 -----------------------------… | |
D apps/bridge/app.rc | 103 -----------------------------… | |
D apps/bridge/comments_list.tpl | 13 ------------- | |
D apps/bridge/foot.tpl | 37 -----------------------------… | |
D apps/dirdir/app.rc | 40 -----------------------------… | |
D apps/dirdir/edit.tpl | 25 ------------------------- | |
D apps/dirdir/sidebar_controls.tpl | 3 --- | |
D apps/hello/app.rc | 10 ---------- | |
D apps/wman/app.rc | 89 -----------------------------… | |
D apps/wman/man_page.tpl | 7 ------- | |
D apps/wman/page_list.tpl | 11 ----------- | |
D apps/wman/search.tpl | 20 -------------------- | |
D apps/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… | |
- } | |
- | |
- 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'.at… | |
-<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 … | |
- if(~ $REQUEST_METHOD POST) { | |
- if(mkbpost $"post_arg_body $"post_date $"post_arg_title $post_… | |
- 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… | |
- # 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 … | |
- | |
- { # XXX Not sure why this fixes issues with blog setup, probably bug in fl… | |
- 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… | |
- sed '1s!.*^') ('^$l(1)^')!' < $p/index.md | |
- echo # Needed extra \n so markdown doesn't mess up the formatting, pro… | |
- } | |
- # XXX BUG! Markdown [references] break because multiple markdown documents… | |
- # TODO: use fltr_cache directly, that can fix the previous bug plus provid… | |
- } | $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 | se… | |
-} | |
- | |
-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 … | |
- | |
- 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_encod… | |
- dprint hget -p 'hub.mode=publish&hub.url='^$"p $conf_blog_pubsubdu… | |
- hget -d -h -p 'hub.mode=publish&hub.url='^$"p $conf_blog_pubsubdub… | |
- } | |
- } | |
- 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-R… | |
-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/; … | |
- # 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 i… | |
- 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 … | |
-} | |
-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/… | |
- <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>[email protected]</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 accepte… | |
-<p>I had originally requested a slot on Saturday. My current slot requires m… | |
- | |
- </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-10… | |
- <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>: … | |
-<p>I don’t know what publishing software you use, but I see you provide an A… | |
- | |
- </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</ci… | |
-<p>I don’t know what publishing software you use, but I see you provide an A… | |
-<p>More specifically, if you have a minor update and leave the updated date al… | |
- | |
- </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-1… | |
- <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 a… | |
-<p>Frankly, my first reaction to this was mixed. The pluses for SVG in CSS i… | |
- | |
- </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 W… | |
-<p>Meanwhile, Robert O’Callahan has been exploring <a href="http://weblogs.m… | |
- | |
- </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])[\-… | |
- 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_ar… | |
- <label>Id: <input size="8" type="text" name="id" value="%($"post_arg_id%)"… | |
- <label>Date: <input size="10" maxlength="10" type="text" name="date" value… | |
- <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]/… | |
- # 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 {$… | |
-} | |
- | |
-%} | |
- | |
-<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> | |
- <channel> | |
- <atom:link href="%($base_url^$req_path%)" rel="self" type="application… | |
- <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</generato… | |
-%{ | |
- # <webMaster>[email protected] (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 … | |
- #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]/… | |
- | |
- 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 $#… | |
- | |
- 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 … | |
- } | |
-} | |
- | |
-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_c… | |
- if not if(test -d etc/users/$usr) | |
- _status='Sorry, user name '''^$usr^''' already taken, please pick a di… | |
- | |
- 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_pas… | |
- 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 b… | |
- } | |
- 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">%($"sa… | |
- <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_use… | |
- </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 revi… | |
- </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… | |
- | |
- if not if(! ~ '' $"post_arg_dirdir_save $"post_arg_edit_text) | |
- save_page | |
- | |
- if not if(~ $"handler_body_main '' || {~ $REQUEST_METHOD GET && test … | |
- ll_add handlers_bar_left tpl_handler apps/dirdir/sidebar_controls.… | |
- } | |
-} | |
- | |
-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 avoi… | |
- 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://daringfireba… | |
- </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]+/[… | |
-fn wman_ls_pages { | |
- ls $* \ | |
- | sed $dirfilter^$wman_junk_filter^' s/\.([0-9]|9p)$//; s!/0intro$!/in… | |
- | 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_fil… | |
- 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^'… | |
- pageTitle=$wman_page' page from Section '$wman_cat' of the '^$"x' … | |
- } | |
- } | |
- | |
- 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^*/… | |
- 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/\.+/./… | |
- 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/ '… | |
- } | |
- | |
-} | |
- | |
-fn wman_get_section_desc { | |
- cat $wman_man_path/^$"wman_cp^$1/0intro* >[2]/dev/null| sed '1,2d; s!intro… | |
-} | |
- | |
-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 n… | |
- 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 … | |
- | 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><… | |
- </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> |