Forgot to update Atom & RSS generators for Markdown support

This commit is contained in:
Gregory Soutade 2014-01-05 22:19:19 +01:00
parent 91849bdccd
commit 44e4729a23
2 changed files with 9 additions and 0 deletions

View File

@ -24,6 +24,7 @@ from dynastie.generators.generator import DynastieGenerator
from dynastie.generators.rss import RSS
from xml.dom.minidom import getDOMImplementation
from django.db import models
from dynastie.generators import markdown2
class Atom(RSS):
@ -80,6 +81,9 @@ class Atom(RSS):
post_content = '<![CDATA[' + f.read() + ']]>'
f.close()
if post.content_format == Post.CONTENT_TEXT:
post_content = markdown2.markdown(post_content)
self.appendElement(dom, item, 'summary', post_content, {'type':'html'})
self.appendElement(dom, item, 'content', post_content, {'type':'html'})
root.appendChild(item)

View File

@ -23,6 +23,8 @@ import xml
from dynastie.generators.generator import DynastieGenerator
from xml.dom.minidom import getDOMImplementation
from django.db import models
from dynastie.generators import markdown2
class RSS(DynastieGenerator):
@ -78,6 +80,9 @@ class RSS(DynastieGenerator):
post_content = f.read()
f.close()
if post.content_format == Post.CONTENT_TEXT:
post_content = markdown2.markdown(post_content)
self.appendElement(dom, item, 'description', '<![CDATA[' + post_content + ']]>')
try: