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