cookutils rev 705

cook: rss: encode predefined XML entities when xml files are generated (let my RSS Reader shows no errors).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Feb 12 02:07:09 2015 +0200 (2015-02-12)
parents a7e3087f5ace
children 073f946f667b
files cook
line diff
     1.1 --- a/cook	Fri Jan 09 13:24:03 2015 +0100
     1.2 +++ b/cook	Thu Feb 12 02:07:09 2015 +0200
     1.3 @@ -954,6 +954,11 @@
     1.4  	exit $status
     1.5  }
     1.6  
     1.7 +# Encode predefined XML entities
     1.8 +xml_ent() {
     1.9 +	sed -e 's|&|\&amp;|g; s|<|\&lt;|g; s|>|\&gt;|g; s|"|\&quot;|g' -e "s|'|\&apos;|g"
    1.10 +}
    1.11 +
    1.12  # Create a XML feed for freshly built packages.
    1.13  gen_rss() {
    1.14  	pubdate=$(date "+%a, %d %b %Y %X")
    1.15 @@ -963,7 +968,7 @@
    1.16  		<link>${COOKER_URL}?pkg=$PACKAGE</link>
    1.17  		<guid>$PACKAGE-$VERSION${EXTRAVERSION}</guid>
    1.18  		<pubDate>$pubdate</pubDate>
    1.19 -		<description>$SHORT_DESC</description>
    1.20 +		<description>$(echo -n "$SHORT_DESC" | xml_ent)</description>
    1.21  	</item>
    1.22  EOT
    1.23  }