nbsp = '\xc2\xa0\xc2\xa0\xc2\xa0\xc2\xa0'
return ''.join([('%s%s%s%s%s</span><br>' % (openTag, '#ff0000' if line.
    startswith('-') else '#007900' if line.startswith('+') else '#000000',
    openTagEnd, nbsp * line.count('\t'), line)) for line in diffData])
Git-diff to HTML