Mercurial > piecrust2
comparison piecrust/formatting/smartypantsformatter.py @ 76:fdb08d986384 2.0.0-alpha2
Add SmartyPants formatting.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 30 Aug 2014 17:35:11 -0700 |
parents | |
children | 370e74941d32 |
comparison
equal
deleted
inserted
replaced
75:1bfcdbbe2572 | 76:fdb08d986384 |
---|---|
1 import smartypants | |
2 from piecrust.formatting.base import Formatter, PRIORITY_LAST | |
3 | |
4 | |
5 class SmartyPantsFormatter(Formatter): | |
6 FORMAT_NAMES = ['html'] | |
7 OUTPUT_FORMAT = 'html' | |
8 | |
9 def __init__(self): | |
10 super(SmartyPantsFormatter, self).__init__() | |
11 self.priority = PRIORITY_LAST | |
12 | |
13 def initialize(self, app): | |
14 super(SmartyPantsFormatter, self).initialize(app) | |
15 self.enabled = ( | |
16 app.config.get('smartypants/enable') or | |
17 app.config.get('smartypants/enabled')) | |
18 | |
19 def render(self, format_name, txt): | |
20 assert format_name == 'html' | |
21 return smartypants.smartypants(txt) | |
22 |