I use the diff-lcs gem to output the difference between the two bodies of html content. Here is the contents of the sample.
Version One:
<p>Paragraph one. Sentence one.</p> <p>Paragraph two. Another sentence.</p> <p>Paragraph three. I dare you to change me!</p>
Second version:
<p>Paragraph one. Sentence two.</p> <p>Paragraph two. Another sentence.</p> <p>Paragraph three. I dare you to update me!</p>
Using this:
seq1 = @versionOne.body seq2 = @versionTwo.body seq = Diff::LCS.diff(seq1, seq2)
You get this monster:
seq => [[#<Diff::LCS::Change:0x0000000be539f8 @action="-", @position=27, @element="t">, #<Diff::LCS::Change:0x0000000be538b8 @action="-", @position=28, @element="w">], [#<Diff::LCS::Change:0x0000000be53520 @action="+", @position=28, @element="n">, #<Diff::LCS::Change:0x0000000be53408 @action="+", @position=29, @element="e">], [#<Diff::LCS::Change:0x0000000be3aa70 @action="-", @position=110, @element="u">, #<Diff::LCS::Change:0x0000000be3a840 @action="-", @position=111, @element="p">, #<Diff::LCS::Change:0x0000000be34ee0 @action="-", @position=112, @element="d">, #<Diff::LCS::Change:0x0000000be349e0 @action="+", @position=110, @element="c">, #<Diff::LCS::Change:0x0000000be348a0 @action="+", @position=111, @element="h">], [#<Diff::LCS::Change:0x0000000be34580 @action="-", @position=114, @element="t">, #<Diff::LCS::Change:0x0000000be34210 @action="+", @position=113, @element="n">, #<Diff::LCS::Change:0x0000000be33f40 @action="+", @position=114, @element="g">], [#<Diff::LCS::Change:0x0000000be331d0 @action="-", @position=124, @element="">]]
The sdiff outputs and other methods found in the documentation are also horrific. I understand the structure of the array (s), but there should be an easy way to show the differences in a human-readable and capable way.
PS - If someone wants to create a diff-lcs , this will be appreciated.