... | ... |
@@ -4,26 +4,24 @@ layout: nil |
4 | 4 |
<?xml version="1.0" encoding="utf-8"?> |
5 | 5 |
<feed xmlns="http://www.w3.org/2005/Atom"> |
6 | 6 |
|
7 |
- <title>{{ site.title | xml_escape }}</title> |
|
7 |
+ <title><![CDATA[{{ site.title }}]]></title> |
|
8 | 8 |
<link href="{{ site.url }}/atom.xml" rel="self"/> |
9 | 9 |
<link href="{{ site.url }}/"/> |
10 | 10 |
<updated>{{ site.time | date_to_xmlschema }}</updated> |
11 | 11 |
<id>{{ site.url }}/</id> |
12 | 12 |
<author> |
13 |
- <name>{{ site.author | xml_escape }}</name> |
|
14 |
- {% if site.email %} |
|
15 |
- <email>{{ site.email | xml_escape }}</email> |
|
16 |
- {% endif %} |
|
13 |
+ <name><![CDATA[{{ site.author | strip_html }}]]></name> |
|
14 |
+ {% if site.email %}<email><![CDATA[{{ site.email }}]]></email>{% endif %} |
|
17 | 15 |
</author> |
18 | 16 |
<generator uri="http://octopress.org/">Octopress</generator> |
19 | 17 |
|
20 | 18 |
{% for post in site.posts limit: 20 %} |
21 | 19 |
<entry> |
22 |
- <title>{{ post.title | xml_escape }}</title> |
|
20 |
+ <title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title> |
|
23 | 21 |
<link href="{{ site.url }}{{ post.url }}"/> |
24 | 22 |
<updated>{{ post.date | date_to_xmlschema }}</updated> |
25 | 23 |
<id>{{ site.url }}{{ post.id }}</id> |
26 |
- <content type="html">{{ post.content | expand_urls: site.url | xml_escape }}</content> |
|
24 |
+ <content type="html"><![CDATA[{{ post.content | expand_urls: site.url | cdata_escape }}]]></content> |
|
27 | 25 |
</entry> |
28 | 26 |
{% endfor %} |
29 | 27 |
</feed> |
... | ... |
@@ -63,6 +63,11 @@ module OctopressLiquidFilters |
63 | 63 |
return (content.nil?) ? input : content |
64 | 64 |
end |
65 | 65 |
|
66 |
+ # Escapes CDATA sections in post content |
|
67 |
+ def cdata_escape(input) |
|
68 |
+ input.gsub(/<!\[CDATA\[/, '<![CDATA[').gsub(/\]\]>/, ']]>') |
|
69 |
+ end |
|
70 |
+ |
|
66 | 71 |
# Replaces relative urls with full urls |
67 | 72 |
def expand_urls(input, url='') |
68 | 73 |
url ||= '/' |