def parseContents(data): """Run the content through the markdown parser and my own parsing""" parsed = [] for x in data.split("\n\n"): if not x.strip(): continue # Comments if x[0:4] == '<!--': continue if x[0:5] == '-----': continue x = markupFirst(x) parsed.append(markdown.markdown(x)) output = header + "\n" for x in parsed: x = markupAfter(x) output += x + "\n" #secHeader + x + secFooter + "\n" output += footer return output
def format_markdown(value, arg=None): return markdown2.markdown(value)
def content(request, blogTitle): blogTitle = re.sub(r"_", r" ", blogTitle) post = article.objects.get(title=blogTitle) post.content = markdown2.markdown(post.content) dict = {"blog": post} return render_to_response("content.html", dict, context_instance=RequestContext(request, processors=[temp_proc]))
def render_post(post): post.content = markdown2.markdown(post.content) return post