Browse Source

{% syntax %} tag: optionally disable generation of <figure> container

main
Ryan Kelly 13 years ago
parent
commit
e6d48b4ad6
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      hyde/ext/templates/jinja.py

+ 3
- 0
hyde/ext/templates/jinja.py View File

@@ -131,6 +131,9 @@ def syntax(env, value, lexer=None, filename=None):
code = pygments.highlight(value, pyg, formatter)
code = code.replace('\n\n', '\n&nbsp;\n').replace('\n', '<br />')
caption = filename if filename else pyg.name
if hasattr(env.config, 'syntax'):
if not getattr(env.config.syntax, 'use_figure', True):
return Markup(code)
return Markup(
'<figure class="code">%s<figcaption>%s</figcaption></figure>\n\n'
% (code, caption))


Loading…
Cancel
Save