Last active
November 27, 2017 08:46
-
-
Save karlcow/78005dd1e0e4a23635e5aa0c0fc74214 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from lxml.html.diff import htmldiff, html_annotate | |
>>> frag1 = """<li class="foo" id="barbitruc">""" | |
>>> frag2 = """<li id="barbitruc" class="foo">""" | |
>>> print htmldiff(frag1, frag2) | |
<li id="barbitruc" class="foo"> | |
>>> htmldiff(frag1, frag2) | |
u'<li id="barbitruc" class="foo">' | |
>>> '<ins>' in htmldiff(frag1, frag2) | |
False | |
>>> '<del>' in htmldiff(frag1, frag2) | |
False | |
>>> frag2 = """<ins><li id="barbitruc" class="foo">item1</li></ins>""" | |
>>> frag1 = """<ins><li class="foo" id="barbitruc">item1</li></ins>""" | |
>>> htmldiff(frag1, frag2) | |
u'<li id="barbitruc" class="foo">item1</li>' | |
>>> '<ins>' in htmldiff(frag1, frag2) | |
False | |
>>> '<del>' in htmldiff(frag1, frag2) | |
False | |
>>> frag1 = """<ins><li class="foo" id="barbitruc" checked>item1</li></ins>""" | |
>>> frag2 = """<ins><li id="barbitruc" class="foo" checked="checked">item1</li></ins>""" | |
>>> htmldiff(frag1, frag2) | |
u'<li id="barbitruc" class="foo" checked>item1</li>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment