changeset 457:7d868afc6791

rendering: Truly skip formatters that are not enabled. This make `smartypants` work as expected.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 09 Jul 2015 21:23:01 -0700
parents 5e902e228053
children 612ed0526afd
files piecrust/formatting/base.py piecrust/rendering.py
diffstat 2 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/formatting/base.py	Thu Jul 09 21:21:40 2015 -0700
+++ b/piecrust/formatting/base.py	Thu Jul 09 21:23:01 2015 -0700
@@ -10,6 +10,7 @@
 
     def __init__(self):
         self.priority = PRIORITY_NORMAL
+        self.enabled = True
 
     def initialize(self, app):
         self.app = app
--- a/piecrust/rendering.py	Thu Jul 09 21:21:40 2015 -0700
+++ b/piecrust/rendering.py	Thu Jul 09 21:23:01 2015 -0700
@@ -382,6 +382,8 @@
     format_count = 0
     format_name = format_name or app.config.get('site/default_format')
     for fmt in app.plugin_loader.getFormatters():
+        if not fmt.enabled:
+            continue
         if fmt.FORMAT_NAMES is None or format_name in fmt.FORMAT_NAMES:
             with app.env.timerScope(fmt.__class__.__name__):
                 txt = fmt.render(format_name, txt)