diff options
| author | Rob Hudson | 2009-09-07 09:47:38 -0700 |
|---|---|---|
| committer | Rob Hudson | 2009-09-07 09:47:38 -0700 |
| commit | 81da67bbfcd18ac9802f652155c331229d7967f2 (patch) | |
| tree | 8c9e3dfd6f2348e5ff9cc9fb4bcc077dd723261b | |
| parent | 6445ef28c70018d8e44db1fc68c8d30ce3c1f777 (diff) | |
| download | django-debug-toolbar-81da67bbfcd18ac9802f652155c331229d7967f2.tar.bz2 | |
Fixed template source to work nicely with and without Pygments.
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/panels/template_source.html | 10 | ||||
| -rw-r--r-- | debug_toolbar/views.py | 1 |
2 files changed, 8 insertions, 3 deletions
diff --git a/debug_toolbar/templates/debug_toolbar/panels/template_source.html b/debug_toolbar/templates/debug_toolbar/panels/template_source.html index 3b265a9..7074f4f 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/template_source.html +++ b/debug_toolbar/templates/debug_toolbar/panels/template_source.html @@ -4,7 +4,11 @@ <h3>Template Source: <code>{{ template_name }}</code></h3> </div> <div class="djDebugPanelContent"> - <div class='scroll'> - {{ source }} - </div> + <div class="scroll"> + {% if not source.pygmentized %} + <pre>{{ source }}</pre> + {% else %} + {{ source }} + {% endif %} + </div> </div> diff --git a/debug_toolbar/views.py b/debug_toolbar/views.py index 3a8cb79..5a412af 100644 --- a/debug_toolbar/views.py +++ b/debug_toolbar/views.py @@ -154,6 +154,7 @@ def template_source(request): source = highlight(source, HtmlDjangoLexer(), HtmlFormatter()) source = mark_safe(source) + source.pygmentized = True except ImportError: pass |
