浏览代码

Move escaping into RSS template.

Brit Butler 12 年之前
父节点
当前提交
e7c74770f0
共有 2 个文件被更改,包括 4 次插入8 次删除
  1. 2 6
      src/feeds.lisp
  2. 2 2
      themes/hyde/rss.tmpl

+ 2 - 6
src/feeds.lisp

@@ -15,10 +15,6 @@
15 15
                        (local-time:now))))
16 16
     (local-time:format-rfc1123-timestring nil timestamp)))
17 17
 
18
-(defun xml-escape (string)
19
-  "Escape the given string for XML."
20
-  (format nil "<![CDATA[ ~A ]]>" string))
21
-
22 18
 (defun render-feed ()
23 19
   "Render and write the feed for the site."
24 20
   (let* ((posts (subseq (by-date (hash-table-values *posts*)) 0 10))
@@ -26,8 +22,8 @@
26 22
                      collect (list :title (post-title post)
27 23
                                    :url (post-url post)
28 24
                                    :date (make-pubdate (post-date post))
29
-                                   :tags (mapcar #'xml-escape (post-tags post))
30
-                                   :content (xml-escape (post-content post))))))
25
+                                   :tags (post-tags post)
26
+                                   :content (post-content post)))))
31 27
     (render-page "rss.xml"
32 28
                  (funcall (theme-fn "RSS")
33 29
                           (list :pubdate (make-pubdate)

+ 2 - 2
themes/hyde/rss.tmpl

@@ -18,9 +18,9 @@
18 18
       <author>{$author}</author>
19 19
       <guid isPermaLink="true">{$siteroot}/posts/{$post.url}</guid>
20 20
       {foreach $tag in $post.tags}
21
-        <category>{$tag |noAutoescape}</category>
21
+        <category><![CDATA[ {$tag} ]]></category>
22 22
       {/foreach}
23
-      <description>{$post.content |noAutoescape}</description>
23
+      <description><![CDATA[ {$post.content} ]]></description>
24 24
     </item>
25 25
     {/foreach}
26 26