[Git][reproducible-builds/diffoscope][master] Correction to HTML markup warnings/errors: fix empty value for attributte name...

Milena Boselli Rosa gitlab at salsa.debian.org
Fri Mar 15 01:14:57 CET 2019


Milena Boselli Rosa pushed to branch master at Reproducible Builds / diffoscope


Commits:
a6fd6b33 by Milena Boselli Rosa at 2019-03-15T00:14:54Z
Correction to HTML markup warnings/errors: fix empty value for attributte name on 'a' tags and add an id to the nearest div containers.


(cherry picked from commit c7c487cc7ac5bef7a6781853d4b714f1752e936c)
- - - - -


1 changed file:

- diffoscope/presenters/html/html.py


Changes:

=====================================
diffoscope/presenters/html/html.py
=====================================
@@ -157,11 +157,14 @@ 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 = ""
+    if anchor:
+        id = u"""id=\"{0}\"""".format(anchor)
     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 +174,16 @@ 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 = ""
+    if anchor:
+        id = u"""id=\"{0}\"""".format(anchor)
     dctrl_class, dctrl = (
         ("diffcontrol", u'⊟')
         if difference.has_visible_children()
@@ -185,8 +192,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 +202,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 +219,7 @@ def output_node_frame(difference, path, indentstr, indentnum, body):
             anchor,
             html.escape(difference.source1),
             html.escape(difference.source2),
+            id,
         )
 
     return PartialString.numl(



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/a6fd6b33e0b2018862e6ae8bfd12884aa96e8eb9

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/commit/a6fd6b33e0b2018862e6ae8bfd12884aa96e8eb9
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/20190315/f7cef0cf/attachment.html>


More information about the rb-commits mailing list