Commits (3)
......@@ -85,9 +85,9 @@ class JSONFile(File):
except Exception:
return
difference.add_comment(
"Similarity: {}%".format(jsondiff.similarity(a, b))
)
similarity = jsondiff.similarity(a, b)
if similarity:
difference.add_comment("Similarity: {}%".format(similarity))
difference.add_comment(
"Differences: {}".format(
......
......@@ -65,7 +65,7 @@ class TextFile(File):
if difference and order_only_difference(
difference.unified_diff
):
difference.add_comment("ordering differences only")
difference.add_comment("Ordering differences only")
if my_encoding != other_encoding:
if difference is None:
difference = Difference(
......
......@@ -242,10 +242,11 @@ def output_node(ctx, difference, path, indentstr, indentnum):
comments = u""
if difference.comments:
comments = u'{0[1]}<div class="comment">\n{1}{0[1]}</div>\n'.format(
comments = u'{1[1]}<div class="comment {0}">{2}{1[1]}</div>\n'.format(
"multiline" if len(difference.comments) > 1 else "",
indent,
"".join(
u"{0[2]}{1}<br/>\n".format(indent, html.escape(x))
"\n".join(
u"{1}".format(indent, html.escape(x))
for x in difference.comments
),
)
......
......@@ -103,6 +103,11 @@ STYLES = """body.diffoscope {
.diffoscope .comment {
font-style: italic;
}
.diffoscope .comment.multiline {
font-style: normal;
font-family: monospace;
white-space: pre;
}
.diffoscope .source {
font-weight: bold;
}
......