Doing and storing a Writeboard like diff in RoR

Hello all,

Anyone have any suggestions on how I could do and display a diffed piece
of
text in a style similar to Writeboard (strikeouts etc.)

Q1) Are there any ruby gems for diff?
Q2) How would I represent the diffed text in styled HTML?

If there are existing tools, any ideas on how I could write this?

Thanks,
Vaishal

Hi,

2006/5/19, Vaishal S. [email protected]:

Anyone have any suggestions on how I could do and display a diffed piece of
text in a style similar to Writeboard (strikeouts etc.)

Q1) Are there any ruby gems for diff?
Q2) How would I represent the diffed text in styled HTML?

There was a mail here on 3.10.05 from Joe C., I quote it below:


Just copy the library from here:
http://dev.instiki.org/file/instiki/trunk/lib/diff.rb.

Save it under your railsdir/lib as diff.rb
In your environment.rb add
require ‘diff’

To use the method in the controller do something like this:
@diff_results = HTMLDiff.diff(@object1.text_to_compare,
@object2.text_to_compare)

in your view do something like this:
<%= @diff_results %>

If you want to change the look of the results, add this to your
stylesheet:

del.diffmod {
color: #999;
background-color: #efefef;
}

ins.diffmod {
background-color: #cfc;
text-decoration: none;
color: #000;
}


HTH,
Beate

diff.rb URL has changed.

http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/instiki/trunk/lib/diff.rb?root=instiki&view=log

just posted this so that I can bookmark this page with correct
information in it :slight_smile: