annotate piecrust/formatting/textileformatter.py @ 853:f070a4fc033c

core: Continue PieCrust3 refactor, simplify pages. The asset pipeline is still the only function pipeline at this point. * No more `QualifiedPage`, and several other pieces of code deleted. * Data providers are simpler and more focused. For instance, the page iterator doesn't try to support other types of items. * Route parameters are proper known source metadata to remove the confusion between the two. * Make the baker and pipeline more correctly manage records and record histories. * Add support for record collapsing and deleting stale outputs in the asset pipeline.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 21 May 2017 00:06:59 -0700
parents f4f5685019a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
124
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
1 from piecrust.formatting.base import Formatter
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
2
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
3
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
4 class TextileFormatter(Formatter):
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
5 FORMAT_NAMES = ['textile', 'text']
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
6 OUTPUT_FORMAT = 'html'
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
7
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
8 def render(self, format_name, text):
423
f4f5685019a2 render: Lazily import Textile package.
Ludovic Chabant <ludovic@chabant.com>
parents: 124
diff changeset
9 from textile import textile
124
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
10 assert format_name in self.FORMAT_NAMES
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
11 return textile(text)
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
12