werc-1.5.0-tweaks

Tweaks for the werc website builder created by the mad architect Uriel
Log | Files | Refs | README

atom.tpl (1895B)


      1 <?xml version="1.0" encoding="utf-8"?>
      2 
      3 %{
      4 # See for more info:http://www.tbray.org/ongoing/When/200x/2005/07/27/Atomic-RSS
      5 fn statpost {
      6     f = $1
      7 
      8     post_uri=$base_url^`{cleanname `{echo $f | sed -e 's!^'$sitedir'!!'}}^'/'
      9     title=`{read $f/index.md}
     10     by=`{ls -m $f | sed 's/^\[//g; s/].*$//g' >[2]/dev/null}
     11     ifs=() { summary=`{cat $f/index.md | strip_title_from_md_file | ifs=$difs {$formatter} } }
     12 }
     13 # rfc3339 date when feed was last updated.
     14 fupdated = `{ndate -a `{date `{mtime `{ls $blagh_root$blagh_dirs/[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/[0-9] | tail -1} | awk '{print $1}'}}}
     15 %}
     16 
     17 <feed xmlns="http://www.w3.org/2005/Atom"
     18     xmlns:thr="http://purl.org/syndication/thread/1.0">
     19 
     20 % if(! ~ $"conf_blog_pubsubdub_hub '') {
     21 %    echo '<link rel="hub" href="'$conf_blog_pubsubdub_hub'" />'
     22 % }
     23 
     24     <link rel="self" href="%($base_url^$req_path%)"/>
     25     <id>%($base_url^$req_path%)</id>
     26     <icon><![CDATA[/favicon.ico]]></icon>
     27 
     28     <title><![CDATA[%($siteTitle%)]]></title>
     29     <subtitle><![CDATA[%($siteSubTitle%)]]></subtitle>
     30 
     31     <updated>%($fupdated%)</updated>
     32     <link href="."/>
     33 
     34 % for(f in `{get_post_list $blagh_root$blagh_dirs}) {
     35 %    statpost $f
     36 
     37     <entry>
     38 % # Maybe we should be smarter, see: http://diveintomark.org/archives/2004/05/28/howto-atom-id, example: <id>tag:intertwingly.net,2004:2899</id>
     39         <id>%($post_uri%)</id>
     40         <link href="%($post_uri%)"/>
     41         <title><![CDATA[%($title%)]]></title>
     42 % # <link rel="replies" href="2899.atom" thr:count="0"/>
     43         <author><name><![CDATA[%($by%)]]></name></author>
     44 
     45         <content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">
     46             <![CDATA[%($summary%)]]>
     47         </div></content>
     48 
     49 % # rfc3339 date when entry was last updated.
     50 % eupdated=`{ndate -a `{date `{mtime $f | awk '{print $1}'}}}
     51         <updated>%($eupdated%)</updated>
     52     </entry>
     53 
     54 % }
     55 
     56 </feed>
     57 
     58 % exit