Commits

Erik Hetzner committed 1d8bbea

load typogrify filters if available

  • Participants
  • Parent commits 6c6299f

Comments (0)

Files changed (1)

sphinx/jinja2glue.py

 
 from sphinx.application import TemplateBridge
 from sphinx.util.osutil import mtimes_of_files
-
-
+try:
+    import typogrify.templatetags.jinja_filters
+except ImportError:
+    typogrify = None
+    
 def _tobool(val):
     if isinstance(val, basestring):
         return val.lower() in ('true', '1', 'yes', 'on')
                                                 extensions=extensions)
         self.environment.filters['tobool'] = _tobool
         self.environment.filters['toint'] = _toint
+        self.environment.filters['toint'] = _toint
         self.environment.globals['debug'] = contextfunction(pformat)
         self.environment.globals['accesskey'] = contextfunction(accesskey)
         self.environment.globals['idgen'] = idgen
+        if typogrify:
+            typogrify.templatetags.jinja_filters.register(self.environment)
         if use_i18n:
             self.environment.install_gettext_translations(
                 builder.app.translator)