Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- openTag = """<span style='font-size:1.0em; color: """
- openTagEnd = ";font-family: courier, arial, helvetica, sans-serif;'>"
- nbsp = ' '
- def _traditional_diff(linesfromDiff, openTag, openTagEnd, nbsp):
- lines = []
- line_num = 0
- def updateLine(line_num, color, line):
- tabs = line.count('t')
- lines.append("%s:%s#%s%s%s%s</span><br>" %
- ((repr(line_num), openTag, color, openTagEnd, nbsp*tabs, line)))
- return lines
- for line in linesfromDiff:
- if (line.startswith('diff ') or
- line.startswith('index ') or
- line.startswith('--- ')):
- color = "10EDF5"
- updateLine(line_num, color, line)
- continue
- if line.startswith('-'):
- color = "ff0000"
- updateLine(line_num, color, line)
- continue
- if line.startswith('+++ '):
- color = "07CB14"
- updateLine(line_num, color, line)
- continue
- if line.startswith('@@ '):
- _, old_nr, new_nr, _ = line.split(' ', 3)
- line_num = int(new_nr.split(',')[0])
- color = "5753BE"
- updateLine(line_num, color, line)
- continue
- if line.startswith('+'):
- color = "007900"
- updateLine(line_num, color, line)
- if line.startswith('+') or line.startswith(' '):
- line_num += 1
- return ''.join(lines)
- <td>
- </td>
- <table><tr>%s</tr></table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement