Exemplo n.º 1
0
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()
Exemplo n.º 2
0
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()
Exemplo n.º 3
0
def dom_diff(old_dom, new_dom):
    # Split all the text nodes in the old and new dom.
    split_text_nodes(old_dom)
    split_text_nodes(new_dom)

    # Get the edit script from the diff algorithm
    differ = Differ(old_dom, new_dom)
    edit_script = differ.get_edit_script()
    # Run the edit script, then use the inserted and deleted nodes metadata to
    #     show changes.
    runner = EditScriptRunner(old_dom, edit_script)
    dom = runner.run_edit_script()
    add_changes_markup(dom, runner.ins_nodes, runner.del_nodes)
    return dom
Exemplo n.º 4
0
def dom_diff(old_dom, new_dom):
    # Split all the text nodes in the old and new dom.
    split_text_nodes(old_dom)
    split_text_nodes(new_dom)

    # Get the edit script from the diff algorithm
    differ = Differ(old_dom, new_dom)
    edit_script = differ.get_edit_script()
    # Run the edit script, then use the inserted and deleted nodes metadata to
    #     show changes.
    runner = EditScriptRunner(old_dom, edit_script)
    dom = runner.run_edit_script()
    add_changes_markup(dom, runner.ins_nodes, runner.del_nodes)
    return dom