Adds CDATA sections to atom.xml, fixes #198
This commit is contained in:
parent
30af4db1cb
commit
6315527b2f
@ -4,26 +4,24 @@ layout: nil
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
|
|
||||||
<title>{{ site.title | xml_escape }}</title>
|
<title><![CDATA[{{ site.title }}]]></title>
|
||||||
<link href="{{ site.url }}/atom.xml" rel="self"/>
|
<link href="{{ site.url }}/atom.xml" rel="self"/>
|
||||||
<link href="{{ site.url }}/"/>
|
<link href="{{ site.url }}/"/>
|
||||||
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
<updated>{{ site.time | date_to_xmlschema }}</updated>
|
||||||
<id>{{ site.url }}/</id>
|
<id>{{ site.url }}/</id>
|
||||||
<author>
|
<author>
|
||||||
<name>{{ site.author | xml_escape }}</name>
|
<name><![CDATA[{{ site.author | strip_html }}]]></name>
|
||||||
{% if site.email %}
|
{% if site.email %}<email><![CDATA[{{ site.email }}]]></email>{% endif %}
|
||||||
<email>{{ site.email | xml_escape }}</email>
|
|
||||||
{% endif %}
|
|
||||||
</author>
|
</author>
|
||||||
<generator uri="http://octopress.org/">Octopress</generator>
|
<generator uri="http://octopress.org/">Octopress</generator>
|
||||||
|
|
||||||
{% for post in site.posts limit: 20 %}
|
{% for post in site.posts limit: 20 %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{ post.title | xml_escape }}</title>
|
<title type="html"><![CDATA[{{ post.title | cdata_escape }}]]></title>
|
||||||
<link href="{{ site.url }}{{ post.url }}"/>
|
<link href="{{ site.url }}{{ post.url }}"/>
|
||||||
<updated>{{ post.date | date_to_xmlschema }}</updated>
|
<updated>{{ post.date | date_to_xmlschema }}</updated>
|
||||||
<id>{{ site.url }}{{ post.id }}</id>
|
<id>{{ site.url }}{{ post.id }}</id>
|
||||||
<content type="html">{{ post.content | expand_urls: site.url | xml_escape }}</content>
|
<content type="html"><![CDATA[{{ post.content | expand_urls: site.url | cdata_escape }}]]></content>
|
||||||
</entry>
|
</entry>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</feed>
|
</feed>
|
||||||
|
@ -63,6 +63,11 @@ module OctopressLiquidFilters
|
|||||||
return (content.nil?) ? input : content
|
return (content.nil?) ? input : content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Escapes CDATA sections in post content
|
||||||
|
def cdata_escape(input)
|
||||||
|
input.gsub(/<!\[CDATA\[/, '<![CDATA[').gsub(/\]\]>/, ']]>')
|
||||||
|
end
|
||||||
|
|
||||||
# Replaces relative urls with full urls
|
# Replaces relative urls with full urls
|
||||||
def expand_urls(input, url='')
|
def expand_urls(input, url='')
|
||||||
url ||= '/'
|
url ||= '/'
|
||||||
|
Loading…
Reference in New Issue
Block a user