Vaishal Sheth
2006-May-19 14:43 UTC
[Rails] 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060519/3e174ee6/attachment.html
Beate Paland
2006-Jun-03 23:18 UTC
[Rails] Doing and storing a Writeboard like diff in RoR
Hi, 2006/5/19, Vaishal Sheth <vpsheth@gmail.com>:> 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 Clarke, 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 :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---