differ
differ copied to clipboard
Something is wrong when there is bold text
Something is wrong when there is bold text (text surrounded by the <strong> element). Take for example:
a = "<p>adfadf<br>\n222<br>\nfoo <strong>bar</strong> was <code>here</code> 333<br>\nhere too<br>\n444<br>\n55 <strong>bold text added</strong><br>\n66</p>\n"
b = "<p>adfadf<br>\n222<br>\nfoo <strong>bar</strong> was <code>here</code> 333<br>\nhere too<br>\n444<br>\n55<br>\n66</p>\n"
Differ.diff_by_word(a, b).format_as(:html).html_safe
The following renders as:
<p>adfadf<br>
222<br>
foo <strong>bar</strong> was <code>here</code> 333<br>
here too<br>
444<br>
55<del class="differ"><</del><ins class="differ"> <strong>bold text added</strong><</ins>br>
66</p>
Notice the < characters. Is this normal? Which renders in the browser inappropriately...
This is fixed if I do diff by line, and not by word. Strange...
It's not designed to be HTML-aware and diffs raw strings. So, tags might be unmatched, or even cut in the middle, this is normal. Outputting source tags as-is in html output is probably a bug: #15.