def html_diff(self, old, new):
def html_transition(old_type, new_type):<EOL><INDENT>tags = []<EOL>for tag in [("<STR_LIT:/>", old_type), ("<STR_LIT>", new_type)]:<EOL><INDENT>if tag[<NUM_LIT:1>] not in ["<STR_LIT:+>", "<STR_LIT:->"]:<EOL><INDENT>continue<EOL><DEDENT>tags.append("<STR_LIT>".format(tag[<NUM_LIT:0>], "<STR_LIT>" if tag[<NUM_LIT:1>] == "<STR_LIT:+>" else "<STR_LIT>"))<EOL><DEDENT>return "<STR_LIT>".join(tags)<EOL><DEDENT>return self._char_diff(old, new, html_transition, fmt=cgi.escape)<EOL>
Return HTML formatted character-based diff between old and new (used for CS50 IDE).