[Git][reproducible-builds/diffoscope][master] 2 commits: Prevent an unnecessary .format() when rendering difference comments.
Chris Lamb
gitlab at salsa.debian.org
Tue Jun 23 11:37:00 UTC 2020
Chris Lamb pushed to branch master at Reproducible Builds / diffoscope
Commits:
c22b9b05 by Chris Lamb at 2020-06-23T12:35:23+01:00
Prevent an unnecessary .format() when rendering difference comments.
- - - - -
c7f9c8ea by Chris Lamb at 2020-06-23T12:36:15+01:00
Use the CSS word-break property over manually adding U+200B zero-width spaces that make copy-pasting cumbersome. (Closes: reproducible-builds/diffoscope!53)
- - - - -
2 changed files:
- diffoscope/presenters/html/html.py
- diffoscope/presenters/html/templates.py
Changes:
=====================================
diffoscope/presenters/html/html.py
=====================================
@@ -64,14 +64,8 @@ from ..utils import (
from . import templates
-# minimum line size, we add a zero-sized breakable space every
-# LINESIZE characters
-LINESIZE = 20
TABSIZE = 8
-# Characters we're willing to word wrap on
-WORDBREAK = " \t;.,/):-"
-
JQUERY_SYSTEM_LOCATIONS = ("/usr/share/javascript/jquery/jquery.js",)
logger = logging.getLogger(__name__)
@@ -163,13 +157,6 @@ def convert(s, ponct=0, tag=""):
t.write(html.escape(c))
i += 1
- if WORDBREAK.count(c) == 1:
- t.write("\u200b")
- i = 0
- if i > LINESIZE:
- i = 0
- t.write("\u200b")
-
return unicodedata.normalize("NFC", t.getvalue())
@@ -264,10 +251,7 @@ def output_node(ctx, difference, path, indentstr, indentnum):
comments = '{1[1]}<div class="comment {0}">{2}{1[1]}</div>\n'.format(
"multiline" if len(difference.comments) > 1 else "",
indent,
- "\n".join(
- "{1}".format(indent, html.escape(x))
- for x in difference.comments
- ),
+ "\n".join(html.escape(x) for x in difference.comments),
)
visuals = ""
=====================================
diffoscope/presenters/html/templates.py
=====================================
@@ -67,6 +67,7 @@ STYLES = """body.diffoscope {
border-collapse:collapse;
font-size:0.75em;
font-family: 'Lucida Console', monospace;
+ word-break: break-word;
}
.diffoscope table.diff tr:hover td {
background: #FFFF00;
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/1e93a1cb3e85b544f503f7306bc38f130c2a3093...c7f9c8ea2e5734b3188b0c588c28fbfc7db36fe7
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/1e93a1cb3e85b544f503f7306bc38f130c2a3093...c7f9c8ea2e5734b3188b0c588c28fbfc7db36fe7
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/20200623/39321835/attachment.htm>
More information about the rb-commits
mailing list