Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Suggestion
Daisy Diff can make a real diff of html-code instead of just striping out html-tags. In GSoC 2008 the author wrote a php version for Wikipedia: http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3/includes/diff/
Maybe it could also be used for the Drupal Diff module?
Daisy Diff Description
Daisy Diff is a Java library that diffs (compares) HTML files. It highlights added and removed words and annotates changes to the styling.
- Works with badly formed HTML that can be found "in the wild".
- The diffing is more specialized in HTML than XML tree differs. Changing part of a text node will not cause the entire node to be changed.
- In addition to the default visual diff, HTML source can be diffed coherently.
- Provides easy to understand descriptions of the changes.
- The default GUI allows easy browsing of the modifications through keyboard shortcuts and links.
Demo of HTML-Diff: http://code.google.com/p/daisydiff/wiki/Examples
Comment | File | Size | Author |
---|---|---|---|
#10 | node.inc_.patch | 566 bytes | andrew_rs |
#10 | diff.pages_.inc_.patch | 539 bytes | andrew_rs |
#10 | diff.module.patch | 1.32 KB | andrew_rs |
#10 | diff.css_.patch | 281 bytes | andrew_rs |
#10 | pear-diff.png | 7.78 KB | andrew_rs |
Comments
Comment #1
scoorch CreditAttribution: scoorch commentedI had a detailed look at daisydiff and started integrating it into the diff module. The problem is that the PHP implementation of daisydiff is very slow when documens are longer (>4 screen pages). I talked to Guy, the developer of daisydiff and he confirmed this. The comparison does not deliver good results for longer documents. Therefore, I can not recommend using daisydiff for the diff module.
Comment #2
yhahn CreditAttribution: yhahn commentedThanks for this evaluation - please feel free to make active again if/when the performance of this library is improved.
Comment #3
sinasalek CreditAttribution: sinasalek commentedPHP API http://code.google.com/p/daisydiff/source/browse/trunk/daisydiff-php/HTM...
PHP version developed for Wikipedia : http://www.mediawiki.org/wiki/Visual_Diff
Comment #4
andrew_rs CreditAttribution: andrew_rs commentedDaisydiff's output does look nice, however including this might be a non-starter due to license issues.
Given that Drupal is released under GPL 2 and Daisydiff Apache 2
From Various Licenses and Comments about Them - GNU Project
http://www.gnu.org/licenses/license-list.html#GPLCompatibleLicenses
Comment #5
sinasalek CreditAttribution: sinasalek commentedlike many other drupal modules it can be used as an optional third party. It does not have to be bounded with this module. it might also be possible to use the java version as well
Comment #6
Mark F CreditAttribution: Mark F commentedsubscribing
Comment #7
andrew_rs CreditAttribution: andrew_rs commentedI've been playing around with a couple diff packages. I'm hoping to have a test patch of one of them up and running soon. Hopefully, I'll post back within a few days.
Comment #8
Murzsubscribe
Comment #10
andrew_rs CreditAttribution: andrew_rs commentedI've created a modified version that uses PEAR's Text_Diff package, which needs to already be installed on your system beforehand.
It's still quite kludgy at the moment, but it appears to work decently enough (but only for nodes in the current version).
I've attached a screenshot along with the patch files.
Also, it might be worthwhile to combine this with http://drupal.org/node/372957 to create a simple configuration screen to toggle between the diff engines and whether or not to include markup.
Comment #11
andrew_rs CreditAttribution: andrew_rs commentedIf you're interested you might also want to look at:
http://drupal.org/project/lifewire_diff
It's only available for 5, but it also uses PEAR Text_diff and I used it as a jumping off point for my experiment. It also allows users to select between the 2 column and single column diff views.
Comment #12
mitchell CreditAttribution: mitchell commentedBumping to 3.x branch. See #1630062: Developmental Roadmap.
Comment #13
mitchell CreditAttribution: mitchell commentedMarked #304618: HTML Filtering (How?) as a duplicate.
Comment #14
mitchell CreditAttribution: mitchell commentedRe #10: There's now an issue to #1826156: Move to Text_Diff library.
HTML-Diff support seems like it should be easy to handle after looking at #10, #304618-3: HTML Filtering (How?), Lifewire Diff, and http://stackoverflow.com/questions/1360610/how-to-show-a-comparison-of-2... .
Comment #15
kscheirerDoes that mean we can close out or postpone this issue?
Comment #16
John Franklin CreditAttribution: John Franklin commentedPatch in #10 works in 6.x-2.3 (with some offsets.)
I agree, it's a little clunky, especially when links change, but works well enough. Thanks.
Comment #17
milovan CreditAttribution: milovan commentedAny progress with this feature? It would be awesome!
Nvm, found it pushed in dev (https://drupal.org/node/372957).
Thanks a lot!
Comment #18
kenorb CreditAttribution: kenorb commentedComment #19
kenorb CreditAttribution: kenorb commented#372957: HTML Strip for Diff, WYSIWYG Friendly
Comment #24
Alan D. CreditAttribution: Alan D. commentedClosing as major developments in 7.x are not going to be continued and 8.x provides a base that includes VisualInlineDiffLayout that uses mkalkbrenner/php-htmldiff-advanced that provides a nice inline diff.