Quantcast
Channel: Insert un-escaped html into rss feed made in django - Stack Overflow
Viewing all articles
Browse latest Browse all 7

Answer by user764357 for Insert un-escaped html into rss feed made in django

$
0
0

So, based on the documentation handler is an XMLGenerator, and calling addQuickElement has the assumption that all of the content is character data. Hence why its being escaped.

What you are probably going to have to do is override SyndicationFeed.add_item_elements(self, handler, item) and insert the a elements using addQuickElement, and add the itunes:summary tags using startElement and endElement.

class iTunesFeed(Rss201rev2Feed):    def add_item_elements(self, handler item):        super(iTunesFeed, self).add_root_elements(handler)        handler.startElement('itunes:summary')        handler.characters('Link to ')                    handler.addQuickElement('a', 'the website', {'href':'http://www.website.com'})        handler.endElement('itunes:summary')

This might not be 100% functional, but should get you pretty close.


Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>