def get_edit_script(old_html, new_html): old_dom = parse_minidom(old_html) new_dom = parse_minidom(new_html) split_text_nodes(old_dom) split_text_nodes(new_dom) differ = Differ(old_dom, new_dom) return differ.get_edit_script()
def html_patch(old_html, edit_script): old_dom = parse_minidom(old_html) split_text_nodes(old_dom) runner = EditScriptRunner(old_dom, edit_script) return minidom_tostring(runner.run_edit_script())