[Git][reproducible-builds/diffoscope][master] 3 commits: Render multiline difference comments in a way to show indentation. (Closes:...
Chris Lamb
gitlab at salsa.debian.org
Wed Apr 22 15:27:48 UTC 2020
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
b72ff87a by Chris Lamb at 2020-04-22T16:27:18+01:00
Render multiline difference comments in a way to show indentation. (Closes: reproducible-builds/diffoscope#101)
- - - - -
30be510f by Chris Lamb at 2020-04-22T16:27:18+01:00
Capitalise "Ordering differences only" in text comparison comments.
- - - - -
f68a0872 by Chris Lamb at 2020-04-22T16:27:18+01:00
Don't include the JSON similarity percentage if it is 0.0%.
- - - - -
4 changed files:
- diffoscope/comparators/json.py
- diffoscope/comparators/text.py
- diffoscope/presenters/html/html.py
- diffoscope/presenters/html/templates.py
Changes:
=====================================
diffoscope/comparators/json.py
=====================================
@@ -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(
=====================================
diffoscope/comparators/text.py
=====================================
@@ -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(
=====================================
diffoscope/presenters/html/html.py
=====================================
@@ -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
),
)
=====================================
diffoscope/presenters/html/templates.py
=====================================
@@ -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;
}
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/137111bbd379c870b5d3fc630fe42bb136fdb893...f68a087216f39dc8bea4346e8d04e2cd70845b3a
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/137111bbd379c870b5d3fc630fe42bb136fdb893...f68a087216f39dc8bea4346e8d04e2cd70845b3a
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20200422/1dd97856/attachment.htm>
More information about the rb-commits
mailing list