From ff237bbc6f908b8ee9a9d1dd7e91e52c7fe30b97 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Sat, 13 Oct 2012 00:42:29 -0400 Subject: [PATCH] RSS feed no longer outputs HTML entities in the title --- msgfmt | 27 ++++++++++++++++++++++++--- rss | 2 +- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/msgfmt b/msgfmt index a21f740..8647468 100755 --- a/msgfmt +++ b/msgfmt @@ -20,6 +20,27 @@ # along with this program. If not, see . # # +# HTML replacements (default) +lquo='\“' +rquo='\”' +mdash='\—' + +# redefines replacements to yield plain text (instead of HTML entities) +nohtml() +{ + lquo=\" + rquo=\" + mdash=--- +} + + +while getopts n opt; do + case "$opt" in + n) nohtml;; + esac +done + + # format the commit message, stopping at the diff (if any) awk '/^diff --git/ { exit } { print }' \ | sed ':a;N;$!ba; @@ -45,7 +66,7 @@ awk '/^diff --git/ { exit } { print }' \ s#\n\n#

&

#g; # basic formatting - s/---/\—/g; - s#``#\“#g; - s#'\'\''#\”#g; + s/---/'"$mdash"'/g; + s#``#'"$lquo"'#g; + s#'\'\''#'"$rquo"'#g; ' diff --git a/rss b/rss index 821f7b1..0caac1d 100755 --- a/rss +++ b/rss @@ -51,7 +51,7 @@ while read hash commit ts id subject; do # the title) cat < - <![CDATA[$( ./msgfmt < <( echo "$subject"; echo ) )]]> + <![CDATA[$( ./msgfmt -n < <( echo "$subject"; echo ) )]]> $( printf "%s/%s/%s.html" \ "${url/%\/}" "$( ./tsdate "$ts" %Y/%m )" "$id"