shithub: werc

Download patch

ref: dd745b3e3eccac8767003cd4680f19fc87a8fa5b
parent: 9943f5b5df9535583db4a1c8277518a5193569bd
author: uriel <[email protected]>
date: Sat Jun 13 11:59:43 EDT 2009

Strip title from rss/atom 'summary'(ie., body).

This used to look really ugly in most feed readers.

--- a/apps/blagh/app.rc
+++ b/apps/blagh/app.rc
@@ -121,3 +121,7 @@
     }
     status=$_status
 }
+
+fn strip_title_from_md_file {
+    sed '1N; /^.*\n===*$/N; /.*\n===*\n$/d'
+}
--- a/apps/blagh/atom.tpl
+++ b/apps/blagh/atom.tpl
@@ -14,7 +14,7 @@
     #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 | ifs=$difs {$formatter} } }
+    ifs=() { summary=`{cat $f/index.md | strip_title_from_md_file | ifs=$difs {$formatter} } }
 }
 updated = `{/bin/date --rfc-3339'=seconds' |sed 's/ /T/'} 
 %}
--- a/apps/blagh/rss20.tpl
+++ b/apps/blagh/rss20.tpl
@@ -13,7 +13,7 @@
     #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 | ifs=$difs {$formatter | escape_html} }}
+    ifs=() {summary=`{ cat $f/index.md |strip_title_from_md_file| ifs=$difs {$formatter | escape_html} }}
 }
 
 %}