From afa783386b6d9473023e9b55d91c24258bb4b7e7 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Tue, 29 Apr 2014 21:59:51 -0700 Subject: [PATCH] Render Markdown blog posts in the RSS feed --- rophako/modules/blog.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rophako/modules/blog.py b/rophako/modules/blog.py index fecb08c..2858f11 100644 --- a/rophako/modules/blog.py +++ b/rophako/modules/blog.py @@ -318,10 +318,21 @@ def rss(): post = Blog.get_entry(post_id) item = doc.createElement("item") channel.appendChild(item) + + # Render the body. + if post["format"] == "markdown": + post["rendered_body"] = render_markdown(post["body"]) + else: + post["rendered_body"] = post["body"] + + # Render emoticons. + if post["emoticons"]: + post["rendered_body"] = Emoticons.render(post["rendered_body"]) + xml_add_text_tags(doc, item, [ ["title", post["subject"]], ["link", url_for("blog.entry", fid=post["fid"], _external=True)], - ["description", post["body"]], + ["description", post["rendered_body"]], ["pubDate", time.strftime(rss_time, time.gmtime(post["time"]))], ])