comparison piecrust/formatting/textileformatter.py @ 423:f4f5685019a2

render: Lazily import Textile package.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 25 Jun 2015 08:31:24 -0700
parents f49fcf9448df
children
comparison
equal deleted inserted replaced
422:a8a12f97addf 423:f4f5685019a2
1 from textile import textile
2 from piecrust.formatting.base import Formatter 1 from piecrust.formatting.base import Formatter
3 2
4 3
5 class TextileFormatter(Formatter): 4 class TextileFormatter(Formatter):
6 FORMAT_NAMES = ['textile', 'text'] 5 FORMAT_NAMES = ['textile', 'text']
7 OUTPUT_FORMAT = 'html' 6 OUTPUT_FORMAT = 'html'
8 7
9 def render(self, format_name, text): 8 def render(self, format_name, text):
9 from textile import textile
10 assert format_name in self.FORMAT_NAMES 10 assert format_name in self.FORMAT_NAMES
11 return textile(text) 11 return textile(text)
12 12