Mercurial > public > sg101
comparison core/markup.py @ 848:32ebe22f0cad
For issue #79 update to Markdown 2.5.1.
This commit follows new Markdown conventions for extensions.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 28 Oct 2014 19:33:14 -0500 |
parents | 7429c98c8ece |
children | ff645a692791 |
comparison
equal
deleted
inserted
replaced
847:ba9216950eb1 | 848:32ebe22f0cad |
---|---|
1 """ | 1 """ |
2 Markup related utitlities useful for the entire project. | 2 Markup related utitlities useful for the entire project. |
3 | |
3 """ | 4 """ |
4 import markdown as _markdown | 5 import markdown as _markdown |
5 from django.utils.encoding import force_unicode | 6 from django.utils.encoding import force_unicode |
6 | 7 |
7 from smiley import SmilifyMarkdown | 8 from smiley import SmilifyMarkdown |
9 from core.mdexts.urlize import UrlizeExtension | |
10 from core.mdexts.deleted import DelExtension | |
8 | 11 |
9 class Markdown(object): | 12 class Markdown(object): |
10 """ | 13 """ |
11 This is a thin wrapper around the Markdown class. | 14 This is a thin wrapper around the Markdown class. |
12 | 15 |
13 """ | 16 """ |
14 def __init__(self, safe_mode='escape'): | 17 def __init__(self, safe_mode='escape'): |
15 self.md = _markdown.Markdown(safe_mode=safe_mode, | 18 self.md = _markdown.Markdown(safe_mode=safe_mode, |
16 extensions=['urlize', 'nl2br', 'del']) | 19 extensions=[ |
20 UrlizeExtension(), | |
21 'markdown.extensions.nl2br', | |
22 DelExtension(), | |
23 ]) | |
17 | 24 |
18 def convert(self, s): | 25 def convert(self, s): |
19 return self.md.convert(force_unicode(s)) | 26 return self.md.convert(force_unicode(s)) |
20 | 27 |
21 | 28 |