aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django/git_wiki
diff options
context:
space:
mode:
authorbnewbold <bnewbold@manus.(none)>2007-06-01 02:27:17 -0400
committerbnewbold <bnewbold@manus.(none)>2007-06-01 02:27:17 -0400
commitc21fcbc9cb3837495549161817f5d02dd9be5d3b (patch)
treec693abcec3acb83c4d391d056ffd50e058a1d7ae /bn_django/git_wiki
parentaff6ddb6508f11cd7b6d17abac60d05ddc0e139b (diff)
downloadbnewnet-c21fcbc9cb3837495549161817f5d02dd9be5d3b.tar.gz
bnewnet-c21fcbc9cb3837495549161817f5d02dd9be5d3b.zip
pygments highlighting for wiki commits
Diffstat (limited to 'bn_django/git_wiki')
-rw-r--r--bn_django/git_wiki/templates/git_wiki/commit.html14
-rw-r--r--bn_django/git_wiki/views.py6
2 files changed, 17 insertions, 3 deletions
diff --git a/bn_django/git_wiki/templates/git_wiki/commit.html b/bn_django/git_wiki/templates/git_wiki/commit.html
index 8497311..82aace4 100644
--- a/bn_django/git_wiki/templates/git_wiki/commit.html
+++ b/bn_django/git_wiki/templates/git_wiki/commit.html
@@ -1,5 +1,9 @@
{% extends "git_wiki/base.html" %}
+{% block stylesheets %}{{ block.super }}
+<link rel="STYLESHEET" type="text/css" href="/static/style/pygments-default.css" />
+{% endblock %}
+
{% block title %}Commit: {{ commit.committer_date}}
{% endblock %}
{% block gitwiki %} {% if commit %}
@@ -23,9 +27,13 @@
{{ commit.committer }}<br />
<b>Committer Date: </b>
{{ commit.committer_date }}<br />
- {% if commit.rawdiff %}
- <pre class="large">{{ commit.rawdiff }}</pre>
- {% else %}No diff{% endif %}
+ {% if commit.pretty_diff %}
+ <pre class="large">{{ commit.pretty_diff}}</pre>
+ {% else %}
+ {% if commit.rawdiff %}
+ <pre class="large">{{ commit.rawdiff }}</pre>
+ {% else %}No difference?{% endif %}
+ {% endif %}
{% else %}
<h3>No such object: {{ hash }}</h3>
{% endif %} {% endblock %}
diff --git a/bn_django/git_wiki/views.py b/bn_django/git_wiki/views.py
index 5a4efbd..dcd1646 100644
--- a/bn_django/git_wiki/views.py
+++ b/bn_django/git_wiki/views.py
@@ -224,6 +224,12 @@ def view_commit(request, hash):
c = Commit(id=hash)
c.update()
+ from pygments import highlight
+ from pygments.lexers import DiffLexer
+ from pygments.formatters import HtmlFormatter
+
+ c.pretty_diff = highlight(c.rawdiff, DiffLexer(), HtmlFormatter())
+
return render_to_response('git_wiki/commit.html',
dict(heads=heads, tags=tags,
commit=c))