This commit is contained in:
Ondřej Nývlt 2023-08-25 22:46:16 +02:00
parent 502b472c07
commit eedc4d198c

View file

@ -14,7 +14,7 @@ from diff_match_patch import diff_match_patch
class DiffThing(diff_match_patch): class DiffThing(diff_match_patch):
def diff_html(self, diffs): def diff_html(self, diffs):
"""Like diff_prettyHtml, but without inline style attributes """Like diff_prettyHtml, but without inline style attributes
(makes it easier to style it with stylesheets). (makes it easier to style it with ).
""" """
html = [] html = []
for op, data in diffs: for op, data in diffs:
@ -27,7 +27,7 @@ class DiffThing(diff_match_patch):
if op == self.DIFF_INSERT: if op == self.DIFF_INSERT:
html.append("<ins>%s</ins>" % text) html.append("<ins>%s</ins>" % text)
elif op == self.DIFF_DELETE: elif op == self.DIFF_DELETE:
html.append('<del">%s</del>' % text) html.append("<del>%s</del>" % text)
elif op == self.DIFF_EQUAL: elif op == self.DIFF_EQUAL:
html.append("<span>%s</span>" % text) html.append("<span>%s</span>" % text)
return "".join(html) return "".join(html)