@classmethod<EOL><INDENT>def diff_to_html(cls, details):<DEDENT>
changes = []<EOL>if not details:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>def _frame(value):<EOL><INDENT>"""<STR_LIT>"""<EOL>if isinstance(value, dict) and '<STR_LIT>' in value:<EOL><INDENT>return value['<STR_LIT>']<EOL><DEDENT>elif isinstance(value, list):<EOL><INDENT>return '<STR_LIT:U+002CU+0020>'.join([_frame(v) for v in value])<EOL><DEDENT>return str(value)<EOL><DEDENT>fields = sorted(details.get('<STR_LIT>', {}))<EOL>for field in fields:<EOL><INDENT>new_value = _frame(details['<STR_LIT>'][field])<EOL>if isinstance(new_value, list):<EOL><INDENT>new_value = '<STR_LIT:U+002CU+0020>'.join([_frame(v) for v in new_value])<EOL><DEDENT>change = cls._templates['<STR_LIT>'].format(<EOL>field=field,<EOL>new_value=new_value<EOL>)<EOL>changes.append(change)<EOL><DEDENT>fields = sorted(details.get('<STR_LIT>', {}))<EOL>for field in fields:<EOL><INDENT>original_value = _frame(details['<STR_LIT>'][field][<NUM_LIT:0>])<EOL>if isinstance(original_value, list):<EOL><INDENT>original_value = '<STR_LIT:U+002CU+0020>'.join([_frame(v) for v in original_value])<EOL><DEDENT>new_value = _frame(details['<STR_LIT>'][field][<NUM_LIT:1>])<EOL>if isinstance(new_value, list):<EOL><INDENT>new_value = '<STR_LIT:U+002CU+0020>'.join([_frame(v) for v in new_value])<EOL><DEDENT>change = cls._templates['<STR_LIT>'].format(<EOL>field=field,<EOL>original_value=original_value,<EOL>new_value=new_value<EOL>)<EOL>changes.append(change)<EOL><DEDENT>fields = sorted(details.get('<STR_LIT>', {}))<EOL>for field in fields:<EOL><INDENT>original_value = _frame(details['<STR_LIT>'][field])<EOL>if isinstance(original_value, list):<EOL><INDENT>original_value = '<STR_LIT:U+002CU+0020>'.join([_frame(v) for v in original_value])<EOL><DEDENT>change = cls._templates['<STR_LIT>'].format(<EOL>field=field,<EOL>original_value=original_value<EOL>)<EOL>changes.append(change)<EOL><DEDENT>return '<STR_LIT:\n>'.join(changes)<EOL>
Return an entry's details in HTML format