Mercurial > public > sg101
comparison gpp/core/markup.py @ 353:6a686ffb6609
Trying out a markdown extension to hopefully fix #166.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 03 Mar 2011 03:00:15 +0000 |
parents | a321685505cc |
children | f54bf3b3bece |
comparison
equal
deleted
inserted
replaced
352:a321685505cc | 353:6a686ffb6609 |
---|---|
16 """ | 16 """ |
17 def __init__(self, safe_mode='escape'): | 17 def __init__(self, safe_mode='escape'): |
18 # Unicode support only in markdown v1.7 or above. Version_info | 18 # Unicode support only in markdown v1.7 or above. Version_info |
19 # exists only in markdown v1.6.2rc-2 or above. | 19 # exists only in markdown v1.6.2rc-2 or above. |
20 self.unicode_support = getattr(_markdown, "version_info", None) >= (1, 7) | 20 self.unicode_support = getattr(_markdown, "version_info", None) >= (1, 7) |
21 self.md = _markdown.Markdown(safe_mode=safe_mode, extensions=['urlize']) | 21 self.md = _markdown.Markdown(safe_mode=safe_mode, |
22 extensions=['urlize', 'nl2br']) | |
22 | 23 |
23 def convert(self, s): | 24 def convert(self, s): |
24 if self.unicode_support: | 25 if self.unicode_support: |
25 return self.md.convert(force_unicode(s)) | 26 return self.md.convert(force_unicode(s)) |
26 else: | 27 else: |