Coding style overhaul for Python files (PEP8 conformant). Removed buggy csstidy pytho...
[redakcja.git] / apps / wiki / nice_diff.py
index c000b13..6f6e607 100755 (executable)
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 #
 # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
-# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.  
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 import difflib
 import re
@@ -9,21 +9,23 @@ import re
 from django.template.loader import render_to_string
 from django.utils.html import escape as html_escape
 
-DIFF_RE = re.compile(r"""\x00([+^-])""" ,re.UNICODE)
-NAMES = { '+': 'added', '-': 'removed', '^': 'changed' }
+DIFF_RE = re.compile(r"""\x00([+^-])""", re.UNICODE)
+NAMES = {'+': 'added', '-': 'removed', '^': 'changed'}
+
 
 def diff_replace(match):
-       return """<span class="diff_mark diff_mark_%s">""" %  NAMES[match.group(1)]
+    return """<span class="diff_mark diff_mark_%s">""" % NAMES[match.group(1)]
+
 
 def filter_line(line):
-       return  DIFF_RE.sub(diff_replace, html_escape(line)).replace('\x01', '</span>')
+    return  DIFF_RE.sub(diff_replace, html_escape(line)).replace('\x01', '</span>')
+
 
 def html_diff_table(la, lb):
-       return render_to_string("wiki/diff_table.html", {
-               "changes": [(a[0],filter_line(a[1]),
-                                        b[0],filter_line(b[1]),
-                                        change) for a, b, change in difflib._mdiff(la, lb)]
-       }); 
-                                                                               
-       
-__all__ = ['html_diff_table']
\ No newline at end of file
+    return render_to_string("wiki/diff_table.html", {
+        "changes": [(a[0], filter_line(a[1]), b[0], filter_line(b[1]), change)
+                        for a, b, change in difflib._mdiff(la, lb)],
+    })
+
+
+__all__ = ['html_diff_table']