| Move form templates to where they blong. - swerc - anselm's simpler werc fork | |
| git clone git://git.suckless.org/swerc | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 8010a7933060dd5c46255ce599288cab16dbbe87 | |
| parent 0c7597c9bea689287b9281fa889bcc30f4ce47f5 | |
| Author: [email protected] <unknown> | |
| Date: Mon, 26 Jan 2009 04:10:02 +0100 | |
| Move form templates to where they blong. | |
| Diffstat: | |
| D lib/_apps/blagh/atom.tpl | 140 -----------------------------… | |
| D lib/_apps/blagh/rss20.tpl | 62 -----------------------------… | |
| D lib/_apps/brag/post_form.tpl | 26 -------------------------- | |
| D lib/_apps/dirdir/edit.tpl | 56 -----------------------------… | |
| 4 files changed, 0 insertions(+), 284 deletions(-) | |
| --- | |
| diff --git a/lib/_apps/blagh/atom.tpl b/lib/_apps/blagh/atom.tpl | |
| @@ -1,140 +0,0 @@ | |
| -Content-Type: application/atom+xml | |
| - | |
| -<?xml version="1.0" encoding="utf-8"?> | |
| - | |
| -<!-- TODO: See for more info:http://www.tbray.org/ongoing/When/200x/2005/07/27… | |
| -%{ | |
| -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'!!' -e 's/… | |
| - 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 512 ... | $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"> | |
| - | |
| - <link rel="self" href="%($req_path%)"/> | |
| - <id>%($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… | |
| - <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/lib/_apps/blagh/rss20.tpl b/lib/_apps/blagh/rss20.tpl | |
| @@ -1,62 +0,0 @@ | |
| -Content-Type: text/xml; charset=utf-8 | |
| - | |
| -<?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' } | |
| - date=`{/bin/date -Rd `{echo $f|sed 's,.*/([0-9][0-9][0-9][0-9]/[0-9][0… | |
| - # 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 -n $post_uri | sed 's/\.(md|tpl)… | |
| - by=$stat(2) | |
| - ifs=() { | |
| - summary=`{awk -v max'='1024 '{ | |
| - nc += 1 + length; | |
| - if(nc > max) { | |
| - print substr($0, 1, nc - max) "..." | |
| - exit | |
| - } | |
| - }' $f/index.md |fmt -j| sed 's/\]\]>/Fucking goddamn XML garba… | |
| - } | |
| -} | |
| - | |
| -%} | |
| - | |
| -<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> | |
| - <channel> | |
| - <atom:link href="%('http://'$site^$req_path%)" rel="self" type… | |
| - <title>%($siteTitle%)</title> | |
| - <link>%($req_path%)</link> | |
| - <description>%($blogDesc%)</description> | |
| - <language>en-us</language> | |
| - <generator>Tom Duff's rc, and Kris Maglione's clever hackery</… | |
| -%{ | |
| - # <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… | |
| - #if(~ $#last_build_date 0) { | |
| - #last_build_date='<lastBuildDate>'^$"mdate'</l… | |
| - #echo $last_build_date | |
| - #} | |
| -%} | |
| - <item> | |
| - <title>%($title%)</title> | |
| - <author>%($by%)@noreply.cat-v.org (%($by%))</author> | |
| - <link>%($uri%)</link> | |
| - <guid isPermaLink="true">%($uri%)</guid> | |
| - <pubDate>%($date%)</pubDate> | |
| - <description><![CDATA[<pre>%($summary%)</pre>]]></desc… | |
| - </item> | |
| -% } | |
| - | |
| - </channel> | |
| -</rss> | |
| diff --git a/lib/_apps/brag/post_form.tpl b/lib/_apps/brag/post_form.tpl | |
| @@ -1,26 +0,0 @@ | |
| -%{ | |
| -get_post_args target_blog_dir post_title post_body | |
| - | |
| -if(~ $REQUEST_METHOD POST && ! ~ $#target_blog_dir 0 && ! ~ $#post_title 0) { | |
| - | |
| - # XXX Need a generic way to load the complete config hierarchy for a given… | |
| - if(test -f $sitedir/$target_blog_dir/_werc/config) | |
| - . $sitedir/$target_blog_dir/_werc/config | |
| - | |
| - if(~ $#blog_editors_group 0) | |
| - echo Cant post to $target_blog_dir, no editors group set. | |
| - if not if(! check_user $blog_editors_group) | |
| - echo Post to $target_blog_dir denied, user $logged_user not in group $… | |
| - if not if(! make_blog_post $target_blog_dir $post_title $post_body) | |
| - echo Posting to $target_blog_dir failed: $status | |
| - if not | |
| - echo Posted to $target_blog_dir. | |
| -} | |
| -%} | |
| -<form method="POST"> | |
| - Submit a new blog post | |
| - Post title: <input type="text" name="post_title" /><br /> | |
| - <textarea name="post_body"></textarea><br /> | |
| - <input type="text" name="target_blog_dir" value="%($target_blog_dir%)" /><… | |
| - <input type="submit" value="Post" /> | |
| -</form> | |
| diff --git a/lib/_apps/dirdir/edit.tpl b/lib/_apps/dirdir/edit.tpl | |
| @@ -1,56 +0,0 @@ | |
| -%{ | |
| -# XXX This should be moved to apps/dirdir/, and we should bail out if not call… | |
| - | |
| -get_post_args edit_wiki_page edit_text edit_preview edit_save | |
| - | |
| -# XXX SECURITY HOLE! should sanitize form input and make sure we only edit fil… | |
| -# This is a start, but should be way more careful | |
| -edit_file = `{echo $sitedir/$edit_wiki_page.md|sed 's/\.\.*/./g'} | |
| - | |
| -if (~ $"edit_save '') { | |
| -%} | |
| -<div> | |
| - <h1>Editing %($edit_wiki_page%)</h1> | |
| - <br /> | |
| - <form action="/_apps/dirdir/edit" method="post"> | |
| - <input type="hidden" name="edit_wiki_page" value="%($edit_wiki_page%)" | |
| - <textarea name="edit_text" id="edit_text" cols="80" rows="43">%{ | |
| - | |
| -if(~ $#edit_text 0 && test -f $edit_file) | |
| - cat $edit_file | escape_html | |
| -if not | |
| - echo $edit_text | escape_html | |
| - | |
| - %}</textarea> | |
| - <br /> | |
| - <input type="submit" name="edit_save" value="Save"/> | |
| - <input type="submit" name="edit_preview" value="Preview" /> | |
| - <small>DirDir documents are written using <a href="http://daringfireba… | |
| - </form> | |
| -</div> | |
| -% } | |
| - | |
| -% if(! ~ $"edit_preview '') { | |
| - <H2>Preview:</H2> | |
| - <div id="preview"> | |
| -% echo $edit_text | $formatter | |
| - </div> | |
| - <hr /><hr /> | |
| -% } | |
| -% if not if(! ~ $"edit_save '') { | |
| -%{ | |
| - dirdir_dir = $edit_file^'_werc/dirdir/' | |
| - | |
| - if(! test -d $dirdir_dir) | |
| - mkdir -p $dirdir_dir | |
| - | |
| - dirdir_verdir = $dirdir_dir/`{date -n}^/ | |
| - mkdir $dirdir_verdir | |
| - | |
| - echo $loggin_user > $dirdir_verdir/author | |
| - echo $edit_text > $dirdir_verdir/data | |
| - echo $edit_text > $edit_file | |
| -%} | |
| -<h1>Saved <a href="%($edit_wiki_page%)">%($edit_wiki_page%)!</a></h1> | |
| -% } | |
| - |