Closed (fixed)
Project:
Diff
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Jul 2010 at 21:41 UTC
Updated:
22 Oct 2012 at 17:41 UTC
Other module can wan to use diff functionality. It would be nice to have an function where we can get a nice and clean output. The function _diff_body_rows almost do it but add some stuff around (like css) and is private.
Something like diff_get_diff(&$old_node, &$new_node) than return an array.
Comments
Comment #1
abaddon commentedsubscribe, i might do this when i get some time, to expand on my patch here http://drupal.org/node/188253#comment-3299972 , i want this for an inline ahah diff of 2 nodes, actually a node and a node comment :-)
another approach would be to make diff_diffs_show return 100% themable output, right now ive added a couple of drupal_alter()s to remove what i dont want
Comment #2
gagarine commentedA themable output would be very nice. But I thinks we need to splite the construction of the diff (an array or object), the themable function, and some wrapper function usable outside as an API.
I also like the way of transliteration module works.
You can call transliteration_get
and the function include the things for you...
Comment #3
yhahn commentedhttp://drupal.org/cvs?commit=405772 adds two API functions for doing your own diff goodness.
Comment #4
gagarine commentedLook nice to compare string but I don't get how compare two node's revisions. Can you give a small example or the right function I should use?
Thanks
Comment #5
xanoI have been working on atrsimilar.module, available in ATR, which uses a diff algorithm as well (but reverses the results to calculate similarity rather than difference). There are lots of applications for diff algorithms like these, but not everybody has the knowledge to create or use one from another project. If there will be one API module with a simple
diff($a, $b)function, every developer will be able to diff two pieces of text, regardless of context (node body, form input) or text format (HTML, markdown, plain text).My question: Can we split Diff 3 into an API module and separate modules for end-user functionality?
Also, for atrsimilar.module I have implemented the LCS algorithm, which is also being used for l10n_server. A quick glance at the phpwiki diff class you are using for diff.module makes me think this algorithm works similarly, but it uses A LOT more code. Can you explain what the diff.module algorithm does exactly?
Comment #6
xanoUpdating issue status. Can we get a 6.x-3.x-dev tag?
Comment #7
mitchell commentedThis is now fixed in the 3.x branch.