diff view

This commit is contained in:
James Turk 2010-03-30 14:42:27 -04:00
parent c8748fca43
commit 1af18276b3
2 changed files with 21 additions and 1 deletions

View File

@ -1,2 +1,20 @@
{% extends "markupwiki/base.html" %}
{% block extrahead %}
<style type="text/css">
table.diff {font-family:Courier; border:medium;}
table.diff td { padding: 1px; }
.diff_header {background-color:#e0e0e0}
td.diff_header {text-align:right}
.diff_next {background-color:#c0c0c0}
.diff_add {background-color:#aaffaa}
.diff_chg {background-color:#ffff77}
.diff_sub {background-color:#ffaaaa}
</style>
{% endblock %}
{% block content %}
<h2>comparison of {{article.title}} revision {{from}} to {{to}}</h2>
{{ table|safe }} {{ table|safe }}
{% endblock content %}

View File

@ -145,5 +145,7 @@ def article_diff(request, title):
from_body = from_version.body.raw.split('\n') from_body = from_version.body.raw.split('\n')
to_body = to_version.body.raw.split('\n') to_body = to_version.body.raw.split('\n')
table = differ.make_table(from_body, to_body) table = differ.make_table(from_body, to_body)
return render_to_response('article_diff.html', {'table':table}, return render_to_response('article_diff.html',
{'article': article, 'table':table,
'from': from_id, 'to':to_id},
context_instance=RequestContext(request)) context_instance=RequestContext(request))