Mercurial > piecrust2
view piecrust/formatting/smartypantsformatter.py @ 1183:62900c42d6dd
admin: Don't pass a custom environment to sub-processes.
Apparently I was trying to be too clever, it's causing problems in some
cases.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 21 May 2020 22:10:04 -0700 |
parents | 370e74941d32 |
children |
line wrap: on
line source
from piecrust.formatting.base import Formatter, PRIORITY_LAST class SmartyPantsFormatter(Formatter): FORMAT_NAMES = ['html'] OUTPUT_FORMAT = 'html' def __init__(self): super(SmartyPantsFormatter, self).__init__() self.priority = PRIORITY_LAST import smartypants self._sp = smartypants.smartypants def initialize(self, app): super(SmartyPantsFormatter, self).initialize(app) self.enabled = ( app.config.get('smartypants/enable') or app.config.get('smartypants/enabled')) def render(self, format_name, txt): assert format_name == 'html' return self._sp(txt)