Invalid Atom feeds for code includes… #510

Closed
mikl opened this Issue Mar 30, 2012 · 3 comments

Comments

Projects
None yet
3 participants
@mikl
Contributor

mikl commented Mar 30, 2012

In #198, @fhemberger introduced CDATA escaping for most of the text fields in the Atom feeds.

That sounded like a good idea at the time, but I have struggled a bit with some feed parsers choking on my feeds, and recently when investigating Atom for something else, I happened on this paragraph: “If type="html", then this element contains entity escaped html.”.

RFC 42 that defines the Atom syndication format also says “If the value of "type" is "html", the content of atom:content MUST NOT contain child elements […] The HTML markup MUST be escaped;

I’m convinced that the use of CDATA instead of escaping the content is what causes some feed parsers to choke on our content. It might not be a direct violation of the spec, but I think it's close enough to cause confusion.

In my naïve hope that I’d found a simple solution to all my problems, I tried changing my feed content to this:

<content type="html">{{ post.content | expand_urls: site.url | markdownify | escape }}</content>

However, that brings me right back where I started, because some of Octopress’ enhancements are only applied after the template is rendered, which result in a broken feed intermixed with HTML, as seen here: http://mikkel.hoegh.org/blog/categories/drupal/atom.xml

Is there a way we can force Octopress to render its extensions in the template, so we can escape their output markup properly?

@imathis

This comment has been minimized.

Show comment Hide comment
@imathis

imathis May 22, 2012

Owner

Is there a way we can force Octopress to render its extensions in the template, so we can escape their output markup properly?

Thanks for looking into this. Can you give me an example of what content will cause this problem so I work on a fix?

Owner

imathis commented May 22, 2012

Is there a way we can force Octopress to render its extensions in the template, so we can escape their output markup properly?

Thanks for looking into this. Can you give me an example of what content will cause this problem so I work on a fix?

@mikl

This comment has been minimized.

Show comment Hide comment
@mikl

mikl May 31, 2012

Contributor

Template tags like {% codeblock %}, {% include_code %} seems to be rendered after the fact, so the are not processed by the escape line…

Contributor

mikl commented May 31, 2012

Template tags like {% codeblock %}, {% include_code %} seems to be rendered after the fact, so the are not processed by the escape line…

@ghost ghost assigned parkr Dec 17, 2012

@parkr

This comment has been minimized.

Show comment Hide comment
@parkr

parkr Nov 18, 2013

Collaborator

Forcing rendering of templates is currently not possible. Thanks for the suggestion, though!

Jekyll has had an xml_escape filter that should be of some service here. :)

Collaborator

parkr commented Nov 18, 2013

Forcing rendering of templates is currently not possible. Thanks for the suggestion, though!

Jekyll has had an xml_escape filter that should be of some service here. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment