コード例 #1
0
ファイル: test_util.py プロジェクト: tex/htmltreediff
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()
コード例 #2
0
ファイル: test_util.py プロジェクト: PolicyStat/htmltreediff
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()
コード例 #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
コード例 #4
0
ファイル: changes.py プロジェクト: iffy/htmltreediff
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