Forum: Ruby on Rails Doing and storing a Writeboard like diff in RoR

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Vaishal S. (Guest)
on 2006-05-19 18:45
(Received via mailing list)
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
Beate P. (Guest)
on 2006-06-04 03:20
(Received via mailing list)
Hi,

2006/5/19, Vaishal S. <removed_email_address@domain.invalid>:
> 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
Jigar G. (Guest)
on 2007-08-05 02:06
diff.rb URL has changed.

http://viewvc.rubyforge.mmmultiworks.com/cgi/viewv...


just posted this so that I can bookmark this page with correct
information in it :)
This topic is locked and can not be replied to.