1
0
Fork 0

RSS feed no longer outputs HTML entities in the title

master
Mike Gerwitz 2012-10-13 00:42:29 -04:00
parent 81356e4104
commit ff237bbc6f
No known key found for this signature in database
GPG Key ID: F22BB8158EE30EAB
2 changed files with 25 additions and 4 deletions

27
msgfmt
View File

@ -20,6 +20,27 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# # # #
# HTML replacements (default)
lquo='\&ldquo;'
rquo='\&rdquo;'
mdash='\&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) # format the commit message, stopping at the diff (if any)
awk '/^diff --git/ { exit } { print }' \ awk '/^diff --git/ { exit } { print }' \
| sed ':a;N;$!ba; | sed ':a;N;$!ba;
@ -45,7 +66,7 @@ awk '/^diff --git/ { exit } { print }' \
s#\n\n#</p>&<p>#g; s#\n\n#</p>&<p>#g;
# basic formatting # basic formatting
s/---/\&mdash;/g; s/---/'"$mdash"'/g;
s#``#\&ldquo;#g; s#``#'"$lquo"'#g;
s#'\'\''#\&rdquo;#g; s#'\'\''#'"$rquo"'#g;
' '

2
rss
View File

@ -51,7 +51,7 @@ while read hash commit ts id subject; do
# the title) # the title)
cat <<EOE cat <<EOE
<item> <item>
<title><![CDATA[$( ./msgfmt < <( echo "$subject"; echo ) )]]></title> <title><![CDATA[$( ./msgfmt -n < <( echo "$subject"; echo ) )]]></title>
<link>$( <link>$(
printf "%s/%s/%s.html" \ printf "%s/%s/%s.html" \
"${url/%\/}" "$( ./tsdate "$ts" %Y/%m )" "$id" "${url/%\/}" "$( ./tsdate "$ts" %Y/%m )" "$id"