comparison gpp/core/markup.py @ 211:3a626c48e9ae

Fix #81: could not get paragraphs in Markdown due to the interaction between smiley and Markdown. Refactored the smilify code to use a series of regular expressions over the text when working with markdown.
author Brian Neal <bgneal@gmail.com>
date Sat, 08 May 2010 23:44:59 +0000
parents 48621ba5c385
children a321685505cc
comparison
equal deleted inserted replaced
210:77b606e0ad5f 211:3a626c48e9ae
2 Markup related utitlities useful for the entire project. 2 Markup related utitlities useful for the entire project.
3 """ 3 """
4 import markdown as _markdown 4 import markdown as _markdown
5 from django.utils.encoding import force_unicode 5 from django.utils.encoding import force_unicode
6 6
7 from smiley import Smilify 7 from smiley import SmilifyMarkdown
8 8
9 class Markdown(object): 9 class Markdown(object):
10 """ 10 """
11 This is a thin wrapper around the Markdown class which deals with the 11 This is a thin wrapper around the Markdown class which deals with the
12 differences in Markdown versions on the production and development server. 12 differences in Markdown versions on the production and development server.
40 This class provides site markup by combining markdown and 40 This class provides site markup by combining markdown and
41 our own smiley markup. 41 our own smiley markup.
42 """ 42 """
43 def __init__(self): 43 def __init__(self):
44 self.md = Markdown() 44 self.md = Markdown()
45 self.smiley = Smilify() 45 self.smiley = SmilifyMarkdown()
46 46
47 def convert(self, s): 47 def convert(self, s):
48 return self.md.convert(self.smiley.markdown(s)) 48 return self.md.convert(self.smiley.convert(s))
49 49
50 50
51 def site_markup(s): 51 def site_markup(s):
52 """ 52 """
53 Convenience function for one-off site markup jobs. 53 Convenience function for one-off site markup jobs.