I love WriteBoard. I''m baffled as to how to go about programming something that can track revisions the way it does? Anyone have any ideas? I''m not interested in making a WriteBoard clone, I just like knowing how stuff works :) - Jim
Johan Sörensen
2005-Oct-03 18:27 UTC
Re: WriteBoard - Compare Revisions - How''d they do that?
On 10/3/05, Jim Jeffers <rails-u78NUfcIof50Y1uG8So6J1aTQe2KTcn/@public.gmane.org> wrote:> I love WriteBoard. I''m baffled as to how to go about programming > something that can track revisions the way it does? Anyone have any > ideas? I''m not interested in making a WriteBoard clone, I just like > knowing how stuff works :)It''s "just" a matter of diffing two strings.. Instiki does it like this http://dev.instiki.org/file/instiki/trunk/lib/diff.rb. I''m guessing wildly that writeboard uses something derived from this.. or you could create something which outputs and parses the "official diff format" (http://www.gnu.org/software/diffutils/diffutils.html). Like so: http://dev.collaboa.org/repository/changesets/239 Cheers, JS -- http://johansorensen.com http://theexciter.com
Robby Russell
2005-Oct-03 18:28 UTC
Re: WriteBoard - Compare Revisions - How''d they do that?
On Mon, 2005-10-03 at 11:19 -0700, Jim Jeffers wrote:> I love WriteBoard. I''m baffled as to how to go about programming > something that can track revisions the way it does? Anyone have any > ideas? I''m not interested in making a WriteBoard clone, I just like > knowing how stuff works :) >http://wiki.rubyonrails.com/rails/pages/ActsAsVersioned Then you could probably use some svn/cvs type diff tool that would prettify the output into colors. Robby -- /****************************************************** * Robby Russell, Owner.Developer.Geek * PLANET ARGON, Open Source Solutions & Web Hosting * Portland, Oregon | p: 503.351.4730 | f: 815.642.4068 * www.planetargon.com | www.robbyonrails.com * Programming Rails | www.programmingrails.com *******************************************************/
Joe Clarke
2005-Oct-03 20:06 UTC
Re: WriteBoard - Compare Revisions - How''d they do that?
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; } Hope this helps, -- Joe Clarke http://railsplayground.com On 10/3/05, Jim Jeffers <rails-u78NUfcIof50Y1uG8So6J1aTQe2KTcn/@public.gmane.org> wrote:> I love WriteBoard. I''m baffled as to how to go about programming > something that can track revisions the way it does? Anyone have any > ideas? I''m not interested in making a WriteBoard clone, I just like > knowing how stuff works :) > > - Jim > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Jim Jeffers
2005-Oct-03 20:39 UTC
Re: WriteBoard - Compare Revisions - How''d they do that?
Wow! Thanks Joe! - Jim On Oct 3, 2005, at 1:06 PM, Joe Clarke wrote:> 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; > } > > > Hope this helps, > > -- > Joe Clarke > http://railsplayground.com > > On 10/3/05, Jim Jeffers <rails-u78NUfcIof50Y1uG8So6J1aTQe2KTcn/@public.gmane.org> wrote: > >> I love WriteBoard. I''m baffled as to how to go about programming >> something that can track revisions the way it does? Anyone have any >> ideas? I''m not interested in making a WriteBoard clone, I just like >> knowing how stuff works :) >> >> - Jim >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
Andrew Otwell
2005-Oct-03 23:43 UTC
Re: WriteBoard - Compare Revisions - How''d they do that?
There''s also a nice Javascript implementation of diff. Here''s the source, although I can''t seem to find the author''s example showing it at work right now: http://ejohn.org/files/jsdiff.js> Wow! Thanks Joe! > > - Jim > > On Oct 3, 2005, at 1:06 PM, Joe Clarke wrote: > > >> Just copy the library from here: >> http://dev.instiki.org/file/instiki/trunk/lib/diff.rb.