Tag: diff lcs

使diff-lcs的输出成为可读的

我正在使用diff-lcs gem来输出两个html内容体之间的差异。 这是示例内容。 第一版: Paragraph one. Sentence one. Paragraph two. Another sentence. Paragraph three. I dare you to change me! 第二版: Paragraph one. Sentence two. Paragraph two. Another sentence. Paragraph three. I dare you to update me! 使用这个: seq1 = @versionOne.body seq2 = @versionTwo.body seq = Diff::LCS.diff(seq1, seq2) 你得到这个怪物: seq => [[#, #], [#, #], […]