33
33
def htmlfy_diff(difftext):
34
34
"""Adds HTML markup to a udiff string"""
35
35
output = cgi.escape(difftext)
36
match_file = re.compile(r'^([\+\-]{3})\s(\S+)\s\((.+)\)$',re.MULTILINE)
37
match_range = re.compile(r'^\@\@ (.*) \@\@$',re.MULTILINE)
38
match_add = re.compile(r'^\+(.*)$',re.MULTILINE)
39
match_sub = re.compile(r'^\-(.*)$',re.MULTILINE)
40
match_special = re.compile(r'^\\(.*)$',re.MULTILINE)
41
output = match_file.sub(
42
r'<span class="diff-files">\1 \2 <em>(\3)</em></span>', output)
43
output = match_range.sub(
44
r'<span class="diff-range">@@ \1 @@</span>', output)
45
output = match_add.sub(
46
r'<span class="diff-add">+\1</span>', output)
47
output = match_sub.sub(
48
r'<span class="diff-sub">-\1</span>', output)
49
output = match_special.sub(
50
r'<span class="diff-special">\\\1</span>', output)
37
r'^([\+\-]{3})\s(\S+)\s\((.+)\)$':
38
r'<span class="diff-files">\1 \2 <em>(\3)</em></span>',
40
r'<span class="diff-range">@@ \1 @@</span>',
42
r'<span class="diff-add">+\1</span>',
44
r'<span class="diff-sub">-\1</span>',
46
r'<span class="diff-special">\\\1</span>'
50
output = re.compile(match, re.MULTILINE).sub(subs[match], output)
53
54
def get_revision(r_str):