Are there any libraries for showing diffs between two web pages?
- by Chad Johnson
I am looking for a library in any language--preferably PHP though--that will display the difference between two web pages. The differences can be displayed side-by-side, all in one document, or in any other creative way.
Examples of what this would look like:
http://1.bp.blogspot.com/_pLC3YDiv_I4/SBZPYQMDsPI/AAAAAAAAADk/wUMxK307jXw/s1600-h/wikipediadiff.jpg
http://www.rohland.co.za/wp-content/uploads/2009/10/html_diff_output_text.PNG
I am NOT looking for raw code diffing, like this: http://thinkingphp.org/img/code_coverage_html_diff_view.png. I do NOT want to show the difference between two sets of HTML. I want to show differences in rendered, WYSIWYG form.
Every solution I tried suffered from one or more of the following problems:
If I change the attribute of an element (eg. change [table border="1"] to [table border="2"]), then I'll have an extra table tag in the output (eg. [table border="1"][table border="1"][tr][td]...). And, one table tag will have a del tag around it, while the other will have an ins tag around it, and that will obviously cause problems.
If I change [html][body][b]some content here[/b][/body][/html] to [html][body][i]some other content here[/i][/body][/html] then it looks like [html][body][b][del]original[/del][i][ins]new[/ins] content here[/b][/i][/body][/html]
I'm looking for out-of-the-box ideas. Any ideas are welcome.