X-Git-Url: http://git.droids-corp.org/?p=diff2html.git;a=blobdiff_plain;f=diff2html.py;h=ad6eaeea71c2373aec987829c72f0d3e9c8bc677;hp=6628a3622d47c82798b83b48585551a4aa1f21cb;hb=adac51ce681152158a4165c6cdf3f58363f2d859;hpb=4f5410c869e253007baa8b5693c09cce4f7f99f5 diff --git a/diff2html.py b/diff2html.py index 6628a36..ad6eaee 100644 --- a/diff2html.py +++ b/diff2html.py @@ -82,7 +82,7 @@ table_footer=""" DIFFON="\x01" DIFFOFF="\x02" -buffer=[] +buf=[] add_cpt, del_cpt = 0,0 line1, line2 = 0,0 hunk_off1, hunk_size1, hunk_off2, hunk_size2 = 0,0,0,0 @@ -229,18 +229,18 @@ def add_line(s1, s2): global line2 if s1==None and s2==None: - type="unmodified" + type_name="unmodified" elif s1==None or s1=="": - type="added" + type_name="added" elif s2==None or s1=="": - type="deleted" + type_name="deleted" elif s1==s2: - type="unmodified" + type_name="unmodified" else: - type="changed" + type_name="changed" s1,s2 = linediff(s1, s2) - outputfile.write(''%type) + outputfile.write(''%type_name) if s1!=None and s1!="": outputfile.write('%d '%line1) outputfile.write('') @@ -268,17 +268,17 @@ def add_line(s1, s2): def empty_buffer(): - global buffer + global buf global add_cpt global del_cpt if del_cpt == 0 or add_cpt == 0: - for l in buffer: + for l in buf: add_line(l[0], l[1]) elif del_cpt != 0 and add_cpt != 0: l0, l1 = [], [] - for l in buffer: + for l in buf: if l[0] != None: l0.append(l[0]) if l[1] != None: @@ -293,11 +293,11 @@ def empty_buffer(): add_line(s0, s1) add_cpt, del_cpt = 0,0 - buffer = [] + buf = [] def parse_input(): - global buffer, add_cpt, del_cpt + global buf, add_cpt, del_cpt global line1, line2 global hunk_off1, hunk_size1, hunk_off2, hunk_size2 @@ -339,20 +339,20 @@ def parse_input(): if re.match("^\+", l): add_cpt += 1 hunk_size2 -= 1 - buffer.append((None, l[1:])) + buf.append((None, l[1:])) continue if re.match("^\-", l): del_cpt += 1 hunk_size1 -= 1 - buffer.append((l[1:], None)) + buf.append((l[1:], None)) continue if re.match("^\ ", l) and hunk_size1 and hunk_size2: empty_buffer() hunk_size1 -= 1 hunk_size2 -= 1 - buffer.append((l[1:], l[1:])) + buf.append((l[1:], l[1:])) continue empty_buffer()