Mercurial > piecrust2
diff piecrust/templating/jinja/extensions.py @ 855:448710d84121
refactor: Get the taxonomy support back to a functional state.
There's now a taxonomy content source that wraps another normal content source
like a blog posts' source. It works in tandem with a taxonomy content pipeline
that will do the heavy lifting of figuring out what kind of terms exist and
need to be baked.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 06 Jun 2017 00:26:21 -0700 |
parents | 2c7e57d80bba |
children | 58e28ba02fb7 |
line wrap: on
line diff
--- a/piecrust/templating/jinja/extensions.py Sun Jun 04 23:34:28 2017 -0700 +++ b/piecrust/templating/jinja/extensions.py Tue Jun 06 00:26:21 2017 -0700 @@ -2,9 +2,6 @@ from jinja2.lexer import Token, describe_token from jinja2.nodes import CallBlock, Const from compressinja.html import HtmlCompressor, StreamProcessContext -from pygments import highlight -from pygments.formatters import HtmlFormatter -from pygments.lexers import get_lexer_by_name, guess_lexer from piecrust.rendering import format_text @@ -65,6 +62,10 @@ def _highlight(self, lang, line_numbers=False, use_classes=False, css_class=None, css_id=None, caller=None): + from pygments import highlight + from pygments.formatters import HtmlFormatter + from pygments.lexers import get_lexer_by_name, guess_lexer + # Try to be mostly compatible with Jinja2-highlight's settings. body = caller() @@ -90,6 +91,7 @@ def get_highlight_css(style_name='default', class_name='.highlight'): + from pygments.formatters import HtmlFormatter return HtmlFormatter(style=style_name).get_style_defs(class_name)