Difference Engine Refactoring and Improvements

Ludovic Dubost ludovic at xwiki.com
Tue May 1 15:22:31 CEST 2007


I have the need to show a better diff page for a page containing an object.
Since there is no generic diff for objects, I'd like to write a Diff 
plugin allowing to make a nice diff of any two strings passed.
At the same time I'd like to start a refactoring of the current diff in 
the same plugin.

Currently I see the following APIs:

DiffPlugin
  // returns a list of org.suigeneris.jrcs.diff.Delta (which representd 
differences)
  getLineDiffAsList(String content1, String content2)
  // returns a list of org.suigeneris.jrcs.diff.Delta (which representd 
differences)
  getWordDiffAsList(String content1, String content2)

  // returns an HTML view of differences
  getLineDiffAsList(String content1, String content2)
  // returns an HTML view of differences
  getWordDiffAsList(String content1, String content2)

  // returns an Text view of differences
  getLineDiffAsList(String content1, String content2)
  // returns an Text view of differences
  getWordDiffAsList(String content1, String content2)

Other APIs could be a function to get a complete diff of an 
XWikiDocument (includes objects, attachements), however the 
implementation itself should probably reside in an velocity template.

There is an interesting discussion to have about how the representation 
of the Text and HTML views should be.
Any ideas ?

Another question is wether it is a good idea to put this as a plugin. I 
think yes since it could be use for other things than the wiki content.

Ludovic

-- 
Ludovic Dubost
Blog: http://www.ludovic.org/blog/
XWiki: http://www.xwiki.com
Skype: ldubost GTalk: ldubost 
AIM: nvludo Yahoo: ludovic





More information about the devs mailing list