caxy / php-htmldiff

A library for comparing two HTML files/snippets and highlighting the differences using simple HTML. Includes support for comparing complex lists and tables
http://php-htmldiff.caxy.com
GNU General Public License v2.0
202 stars 51 forks source link

Add function to clear content. #39

Closed JuliaBayer closed 8 years ago

JuliaBayer commented 8 years ago

I use your library for Drupal with the HTML Diff module (https://www.drupal.org/project/html_diff). Here it is possible to compare the content of several fields. Without a possibility to clear the content, the diff for the second field also shows the content of the first one, the third field also shows content of no. 1 and 2, and so on (see picture). Therefor I wanted to ask, if it's possible to add a clearing function?

html_diff-double-content

jschroed91 commented 8 years ago

@JuliaBayer If you're able to, can you please make the updates suggested in the comment - then I'll merge this in!

If you don't have the time and would prefer I make the changes, let me know and I can do that as well - totally fine either way!

Thank you very much for contributing and I'm happy to hear this is being used in the Drupal module! If you'd like me to add a link to the module in the README let me know.

JuliaBayer commented 8 years ago

@jschroed91 Probably I was too rash with my request... First we need to tidy up a class we interposed between the Drupal module and your library. After this I will possibly get in touch with you again :) Nevertheless: thank you!

jschroed91 commented 8 years ago

@JuliaBayer I added the function clearContent to the AbstractDiff class in this PR: #44

HtmlDiff extends AbstractDiff, so the end result should be the same as what you were looking for. Only difference was that I set $this->content = null instead of $this->content = ''.

Let me know if you need anything else! And always feel free to open a pull request for any updates, we welcome any contributions and are always looking to improve this library.

JuliaBayer commented 8 years ago

@jschroed91 Alright, thank you.