annotate piecrust/formatting/textileformatter.py @ 338:938be93215cb

bake: Improve render context and bake record, fix incremental bake bugs. * Used sources and taxonomies are now stored on a per-render-pass basis. This fixes bugs where sources/taxonomies were used for one pass, but that pass is skipped on a later bake because its result is cached. * Bake records are now created for all pages even when they're not baked. Record collapsing is gone except for taxonomy index pages. * Bake records now also have sub-entries in order to store information about each sub-page, since some sub-pages could use sources/taxonomies differently than others, or be missing from the output. This lets PieCrust handle clean/dirty states on a sub-page level.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 06 Apr 2015 19:59:54 -0700
parents f49fcf9448df
children f4f5685019a2
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 textile import textile
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
2 from piecrust.formatting.base import Formatter
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
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
5 class TextileFormatter(Formatter):
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
6 FORMAT_NAMES = ['textile', 'text']
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
7 OUTPUT_FORMAT = 'html'
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
8
f49fcf9448df Add Textile formatter.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
9 def render(self, format_name, text):
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