Fix entity encoding in generated xml
Tomas Doran [Tue, 26 Jan 2010 01:59:53 +0000 (01:59 +0000)]
ISSUES
root/opml.tt2
root/repository/atom.tt2
root/repository/rss.tt2

diff --git a/ISSUES b/ISSUES
index d0b2d00..158665c 100644 (file)
--- a/ISSUES
+++ b/ISSUES
@@ -1,7 +1,6 @@
 * Root /search page doesn't do anything
 * Atom feed sucks shit (see t/atom.t)
 * OPML & RSS & Atom Feed dates incorrect format
-* Feeds don't do XML entity escaping on the crap they print.
 * Sort out commitdiff so conflicted merges have an equivalent display to gitweb (d7f39bebabeb31ce9a7b4f1b6f3db9f391b78c3e as a reference)
 * Need to sanitise the input ...
 * The snapshot action does not properly support tgz - requests for this format will receive a tar.  tbz2 is not supported at all (yet).
index a05297e..35f22e3 100644 (file)
@@ -4,7 +4,7 @@
     [% FOR Repository = Repositories %]
     <outline id="[% count %]"
              description=""
-             text="[% Repository.name %] - [% Repository.description %]"
+             text="[% Repository.name | html_entity %] - [% Repository.description | html_entity %]"
              title=""
              type="rss"
              version="RSS"
@@ -14,6 +14,6 @@
     <head>
         <dateCreated>[% now %]</dateCreated>
         <dateModified>[% now %]</dateModified>
-        <title>[% title %]</title>
+        <title>[% title | html_entity %]</title>
     </head>
 </opml>
index 1d52779..bd143a1 100644 (file)
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
 <feed xmlns="http://purl.org/atom/ns#">
-  <title>[% title %]</title>
+  <title>[% title | html_entity %]</title>
   <modified>[% updated %]</modified>
   [% FOREACH Commit = Commits %]
   <entry>
-    <title>[% Commit.title %]</title>
+    <title>[% Commit.title | html_entity %]</title>
     <id>[% Commit.id %]</id>
     <content mode="xml">
-      <div xmlns="http://www.w3.org/1999/xhtml">[% Commit.content %]</div>
+      <div xmlns="http://www.w3.org/1999/xhtml">[% Commit.content | html_entity %]</div>
     </content>
   </entry>
   [% END %]
index d1a47cc..bd2c766 100644 (file)
@@ -2,16 +2,16 @@
 <rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">
 
 <channel>
-<title>[% title %]</title>
+<title>[% title | html_entity %]</title>
 <link>[% c.uri_for_action('/repository/summary', [Repository.name]) %]</link>
-<description>[% Repository.description %]</description>
+<description>[% Repository.description | html_entity %]</description>
 <language>[% lang %]</language>
 <pubDate>[% pubDate %]</pubDate>
 <lastBuildDate>[% lastBuildDate %]</lastBuildDate>
 [% FOREACH Commit = Commits %]
 <item>
-<title>[% Commit.title %]</title>
-<description>[% Commit.description %]</description>
+<title>[% Commit.title | html_entity %]</title>
+<description>[% Commit.description | html_entity %]</description>
 <guid isPermaLink="true">[% Commit.permaLink %]</guid>
 </item>
 [% END %]