[Git][reproducible-builds/diffoscope][master] 4 commits: Fix a "table column x established by element 'col' has no cells beginning in...

Chris Lamb gitlab at salsa.debian.org
Wed Mar 20 14:18:46 CET 2019


Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
951bcaff by Milena Boselli Rosa at 2019-03-20T13:16:20Z
Fix a "table column x established by element 'col' has no cells beginning in it" HTML validation error.

The first row after the header in a table can't use the "colspan" attribute.

Signed-off-by: Chris Lamb <lamby at debian.org>

- - - - -
92385ceb by Milena Boselli Rosa at 2019-03-20T13:16:45Z
Fix a "Text run is not in Unicode Normalization Form C" HTML validation warning.

Signed-off-by: Chris Lamb <lamby at debian.org>

- - - - -
41968b8c by Milena Boselli Rosa at 2019-03-20T13:17:00Z
Prevent empty values for the "name" attribute name on HTML anchor tags, and add an "id" to its parent "div" container.

Signed-off-by: Chris Lamb <lamby at debian.org>

- - - - -
fc082d25 by Milena Boselli Rosa at 2019-03-20T13:18:01Z
Remove the "type" HTML attribute from the "style" elements.

Signed-off-by: Chris Lamb <lamby at debian.org>

- - - - -


2 changed files:

- diffoscope/presenters/html/html.py
- diffoscope/presenters/html/templates.py


Changes:

=====================================
diffoscope/presenters/html/html.py
=====================================
@@ -42,6 +42,7 @@ import logging
 import os
 import re
 import sys
+from unicodedata import normalize
 from urllib.parse import urlparse
 
 from diffoscope import VERSION
@@ -150,18 +151,19 @@ def convert(s, ponct=0, tag=''):
             i = 0
             t.write('\u200b')
 
-    return t.getvalue()
+    return normalize('NFC', t.getvalue())
 
 
 def output_visual(visual, path, indentstr, indentnum):
     logger.debug('including image for %s', visual.source)
     indent = tuple(indentstr * (indentnum + x) for x in range(3))
     anchor = output_anchor(path)
+    id = 'id="{}"'.format(anchor) if anchor else ''
     return u"""{0[0]}<div class="difference">
 {0[1]}<div class="diffheader">
 {0[1]}<div class="diffcontrol">⊟</div>
-{0[1]}<div><span class="source">{1}</span>
-{0[2]}<a class="anchor" href="#{2}" name="{2}">\xb6</a>
+{0[1]}<div {5}><span class="source">{1}</span>
+{0[2]}<a class="anchor" href="#{2}">\xb6</a>
 {0[1]}</div>
 {0[1]}</div>
 {0[1]}<div class="difference"><img src=\"data:{3},{4}\" alt=\"compared images\" /></div>
@@ -171,12 +173,14 @@ def output_visual(visual, path, indentstr, indentnum):
         anchor,
         visual.data_type,
         visual.content,
+        id,
     )
 
 
 def output_node_frame(difference, path, indentstr, indentnum, body):
     indent = tuple(indentstr * (indentnum + x) for x in range(3))
     anchor = output_anchor(path)
+    id = 'id="{}"'.format(anchor) if anchor else ''
     dctrl_class, dctrl = (
         ("diffcontrol", u'⊟')
         if difference.has_visible_children()
@@ -185,8 +189,8 @@ def output_node_frame(difference, path, indentstr, indentnum, body):
     if difference.source1 == difference.source2:
         header = u"""{0[1]}<div class="{1}">{2}</div>
 {0[1]}<div><span class="diffsize">{3}</span></div>
-{0[1]}<div><span class="source">{5}</span>
-{0[2]}<a class="anchor" href="#{4}" name="{4}">\xb6</a>
+{0[1]}<div {6}><span class="source">{5}</span>
+{0[2]}<a class="anchor" href="#{4}">\xb6</a>
 {0[1]}</div>
 """.format(
             indent,
@@ -195,13 +199,14 @@ def output_node_frame(difference, path, indentstr, indentnum, body):
             sizeof_fmt(difference.size()),
             anchor,
             html.escape(difference.source1),
+            id,
         )
     else:
         header = u"""{0[1]}<div class="{1} diffcontrol-double">{2}</div>
 {0[1]}<div><span class="diffsize">{3}</span></div>
 {0[1]}<div><span class="source">{5}</span> vs.</div>
-{0[1]}<div><span class="source">{6}</span>
-{0[2]}<a class="anchor" href="#{4}" name="{4}">\xb6</a>
+{0[1]}<div {7}><span class="source">{6}</span>
+{0[2]}<a class="anchor" href="#{4}">\xb6</a>
 {0[1]}</div>
 """.format(
             indent,
@@ -211,6 +216,7 @@ def output_node_frame(difference, path, indentstr, indentnum, body):
             anchor,
             html.escape(difference.source1),
             html.escape(difference.source2),
+            id,
         )
 
     return PartialString.numl(
@@ -305,9 +311,7 @@ def output_header(css_url, our_css_url=False, icon_url=None):
             % our_css_url
         )
     else:
-        css_style = (
-            u'<style type="text/css">\n' + templates.STYLES + u'</style>\n'
-        )
+        css_style = '<style>\n{}</style>\n'.format(templates.STYLES)
     if icon_url:
         favicon = icon_url
     else:


=====================================
diffoscope/presenters/html/templates.py
=====================================
@@ -194,7 +194,7 @@ $(function() {
   $(".diffcontrol-nochildren").show();
 });
 </script>
-<style type="text/css">
+<style>
 .diffoscope table.diff tr.ondemand td, .diffoscope div.ondemand-details {
   background: #f99;
   text-align: center;
@@ -228,6 +228,7 @@ DIFFNODE_LIMIT = """<div class="error">Max report size reached</div>
 UD_TABLE_HEADER = """<table class="diff">
 <colgroup><col class="colines"/><col class="coldiff"/>
 <col class="colines"/><col class="coldiff"/></colgroup>
+<tr style="display:none;"><td> </td><td> </td><td> </td><td> </td></tr>
 """
 
 UD_TABLE_FOOTER = """<tr class="ondemand"><td colspan="4">



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/ff28b6ebd4e808705808945e722da03388ef53a3...fc082d258152c563d217476bb61a0c3b40a968e9

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/ff28b6ebd4e808705808945e722da03388ef53a3...fc082d258152c563d217476bb61a0c3b40a968e9
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/20190320/b8748525/attachment.html>


More information about the rb-commits mailing list