From 7f12eb95a8ffa30a44a3e270163af263fc9f003b Mon Sep 17 00:00:00 2001 From: uriel Date: Sat, 13 Jun 2009 15:59:43 +0200 Subject: [PATCH] Strip title from rss/atom 'summary'(ie., body). This used to look really ugly in most feed readers. --- apps/blagh/app.rc | 4 ++++ apps/blagh/atom.tpl | 2 +- apps/blagh/rss20.tpl | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/blagh/app.rc b/apps/blagh/app.rc index 18309e8..0c11985 100644 --- a/apps/blagh/app.rc +++ b/apps/blagh/app.rc @@ -121,3 +121,7 @@ fn mkbpost { } 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 index 49ecbe1..8a5a08b 100644 --- a/apps/blagh/atom.tpl +++ b/apps/blagh/atom.tpl @@ -14,7 +14,7 @@ fn statpost { #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/'} %} diff --git a/apps/blagh/rss20.tpl b/apps/blagh/rss20.tpl index 141e891..6a1ed58 100644 --- a/apps/blagh/rss20.tpl +++ b/apps/blagh/rss20.tpl @@ -13,7 +13,7 @@ fn statpost { #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} }} } %}