diff --git a/pastebin/apps/dpaste/templates/dpaste/snippet_details.html b/pastebin/apps/dpaste/templates/dpaste/snippet_details.html
index 45ea48d..81c332d 100644
--- a/pastebin/apps/dpaste/templates/dpaste/snippet_details.html
+++ b/pastebin/apps/dpaste/templates/dpaste/snippet_details.html
@@ -49,7 +49,7 @@
{% for l in lines %}{{ forloop.counter }}{% endfor %} |
- {% for line in snippet.content_splitted %}{% if line %}{{ line|safe }}{% else %} {% endif %} {% endfor %} |
+ {% for line in snippet|highlight %}{% if line %}{{ line|safe }}{% else %} {% endif %} {% endfor %} |
diff --git a/pastebin/apps/dpaste/templatetags/dpaste_tags.py b/pastebin/apps/dpaste/templatetags/dpaste_tags.py
index 4f2e463..1b5279f 100644
--- a/pastebin/apps/dpaste/templatetags/dpaste_tags.py
+++ b/pastebin/apps/dpaste/templatetags/dpaste_tags.py
@@ -1,7 +1,17 @@
from django.template import Library
+from django.utils.safestring import mark_safe
+
+from pastebin.apps.dpaste.highlight import pygmentize
register = Library()
@register.filter
def in_list(value,arg):
return value in arg
+
+@register.filter
+def highlight(snippet):
+ h = pygmentize(snippet.content, snippet.lexer)
+ if not h:
+ return snippet.content.splitlines()
+ return h.splitlines()
\ No newline at end of file