initial import of changes from 9front bikeshedding; bundle rc-httpd

This commit is contained in:
Stanley Lieber 2016-02-04 15:05:05 -05:00
parent 6d3bcc867c
commit a99fa8b44f
46 changed files with 1061 additions and 572 deletions

View file

@ -26,7 +26,7 @@ fn blagh_init {
if(check_user $conf_blog_editors) {
editor_mode=on
if(~ $"post_arg_date '')
post_date=`{/bin/date +%F|sed 's,-,/,g'}
post_date=`{date -i|sed 's,-,/,g'} # date -i is 9front/9base only
if not
post_date=$post_arg_date
ll_add handlers_bar_left echo '<a href="'$blagh_uri'new_post">Make a new post</a>'

View file

@ -5,18 +5,18 @@
fn statpost {
f = $1
updated = `{/bin/date --rfc-3339'=seconds' -r $f |tr ' ' 'T'}
updated = `{date -t `{mtime $f | awk '{print $1}'}} # date -t is 9front/9base only
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}
#stat=`{stat -c '%Y %U' $f}
#mdate=`{/bin/date -Rd `{mtime $f|awk '{print $1}' }} # Not used because it is unreliable
by=$stat(2)
by=`{ls -m $f | sed 's/^\[//g; s/].*$//g' >[2]/dev/null}
#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/'}
updated = `{date -t} # date -t is 9front/9base only
%}
<feed xmlns="http://www.w3.org/2005/Atom"
@ -28,10 +28,10 @@ updated = `{/bin/date --rfc-3339'=seconds' |sed 's/ /T/'}
<link rel="self" href="%($base_url^$req_path%)"/>
<id>%($base_url^$req_path%)</id>
<icon>/favicon.ico</icon>
<icon><![CDATA[/favicon.ico]]></icon>
<title>%($siteTitle%)</title>
<subtitle>%($siteSubTitle%)</subtitle>
<title><![CDATA[%($siteTitle%)]]></title>
<subtitle><![CDATA[%($siteSubTitle%)]]></subtitle>
% # <updated>2008-09-24T12:47:00-04:00</updated>
<updated>%($updated%)</updated>
@ -44,13 +44,13 @@ updated = `{/bin/date --rfc-3339'=seconds' |sed 's/ /T/'}
% # 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>
<title><![CDATA[%($title%)]]></title>
% # <link rel="replies" href="2899.atom" thr:count="0"/>
<author><name>%($by%)</name></author>
<author><name><![CDATA[%($by%)]]></name></author>
<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
%($summary%)
<![CDATA[%($summary%)]]>
</div></content>
<updated>%($updated%)</updated>
@ -61,79 +61,3 @@ updated = `{/bin/date --rfc-3339'=seconds' |sed 's/ /T/'}
</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>Its 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>.  Ive again asked that the slot be changed, but even if it doesnt 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 youre 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 didnt have to worry about it).</em></p>
<p>I dont 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 youre 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 didnt have to worry about it).</em></p>
<p>I dont 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, Ive taken another look at Opera.  Opera doesnt 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 doesnt 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> dont 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, Ive taken another look at Opera.  Opera doesnt 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 OCallahan 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>

View file

@ -6,13 +6,13 @@ fn statpost {
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,'}}
title=`{read $f/index.md}
date=`{date `{mtime $f | awk '{print $1}'}} # rss 2.0 spec says pubDate should conform to rfc822
# TODO: use mtime(1) and ls(1) instead of lunix's stat(1)
stat=`{stat -c '%Y %U' $f}
#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)
by=`{ls -m $f | sed 's/^\[//g; s/].*$//g' >[2]/dev/null}
ifs=() {summary=`{ cat $f/index.md |strip_title_from_md_file| ifs=$difs {$formatter | escape_html} }}
}
@ -21,11 +21,11 @@ fn statpost {
<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>
<title><![CDATA[%($siteTitle%)]]></title>
<link>%($base_url^$req_path%)</link>
<description>%($blogDesc%)</description>
<description><![CDATA[%($blogDesc%)]]></description>
<language>en-us</language>
<generator>Tom Duff's rc, and Kris Maglione's clever hackery</generator>
<generator><![CDATA[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}) {
@ -39,12 +39,12 @@ fn statpost {
#}
%}
<item>
<title>%($title%)</title>
<author>%($by%)@noreply.cat-v.org (%($by%))</author>
<title><![CDATA[%($title%)]]></title>
<author><![CDATA[%($by%)@noreply.cat-v.org (%($by%))]]></author>
<link>%($post_uri%)</link>
<guid isPermaLink="true">%($post_uri%)</guid>
<pubDate>%($date%)</pubDate>
<description>%($summary%)</description>
<description><![CDATA[%($summary%)]]></description>
</item>
% }

0
apps/bridge/app.rc Normal file → Executable file
View file

0
apps/bridge/comments_list.tpl Normal file → Executable file
View file

0
apps/bridge/foot.tpl Normal file → Executable file
View file

2
apps/dirdir/app.rc Normal file → Executable file
View file

@ -7,7 +7,7 @@ fn conf_enable_wiki {
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
# werc.rc doesn't append /index when $local_path doesn't exist
# maybe it should, but for now we can fix it up here.
if(~ $lp */)
lp=$lp^'index'

0
apps/dirdir/edit.tpl Normal file → Executable file
View file

0
apps/dirdir/sidebar_controls.tpl Normal file → Executable file
View file

33
apps/paste/app.rc Executable file
View file

@ -0,0 +1,33 @@
fn conf_enable_paste {
paste_url=$conf_wd
paste_dir=`{pwd}
conf_enable_app paste
}
fn paste_init {
if (~ $REQUEST_METHOD POST && ~ $post_arg_url url && ~ $req_path $paste_url ) { # incoming paste
now=`{ date -n }
cksum=`{ echo $"post_arg_paste | sum | awk '{ print $1 }' }
if (~ $cksum '1715a8eb' ) { # empty paste; discard
post_redirect $base_url^$paste_url
}
if not { # save and redirect
# TODO: stop using echo
echo $"post_arg_paste > $paste_dir^/^$now^.^$cksum
#cat<<EOF > $paste_dir^/^$now^.^$cksum
#$"post_arg_paste
#EOF
#post_redirect $base_url^$paste_url^$now^.^$cksum
echo 'Content-type: text/plain'; echo ''; exec echo $base_url^$paste_url^$now^.^$cksum
}
}
if not { # show a paste if there is one
if (test -r $werc_root/$local_path && ~ $QUERY_STRING raw ) {
echo 'Content-type: text/plain'; echo ''; exec cat $werc_root/$local_path
}
}
# if we haven't done anything by now, we don't care. we just exit and let
# werc handle it from here.
}

6
apps/wman/app.rc Normal file → Executable file
View file

@ -71,7 +71,6 @@ fn wman_get_section_desc {
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
}
@ -80,10 +79,11 @@ fn wman_out_filter {
}
fn wman_default_out_filter {
# Using GNU col here to remove nroffs garbage (eg., from .ft B); p9p has no col(1) :(
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}'
| awk '/^$/ {if(n != 1) print; n=1; next} /./ {n=0; print}' \
| col -x
}

6
apps/wman/man_page.tpl Normal file → Executable file
View file

@ -1,7 +1,3 @@
<pre>
%{
wman_page_gen $wman_page_file
%}
% wman_page_gen $wman_page_file
</pre>

13
apps/wman/page_list.tpl Normal file → Executable file
View file

@ -1,11 +1,8 @@
% d=`{wman_get_section_desc $wman_cat}
<h1>Manual pages - Section %($wman_cat%): %($"d%)</h1>
% d=`{wman_get_section_desc $wman_cat}
<h1>Manual pages - Section
% echo $wman_cat': '$"d2
</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\">" }'
%}
% 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>

0
apps/wman/search.tpl Normal file → Executable file
View file

0
apps/wman/section_list.tpl Normal file → Executable file
View file