The following document is converted to invalid HTML.
Input:
.. _label0:
.. _label1:
* list_item
Output:
<ul class="simple" id="label1">
<span id="label0"></span><li>list_item</li>
</ul>
The HTML writers generate empty span tags to create hyperlink targets if the listing node having multiple IDs.
But HTML expects listing elements (ul, ol and dl) have only li elements.
refs:
My patch fixes HTML writers both HTML4 and HTML5. With the patch, the document will be converted to following:
<span id="label0"></span><ul class="simple" id="label1">
<li>list_item</li>
</ul>
Thanks,
I suppose the patch could be made simpler by using the "empty" argument of starttag():
- self.body.append(self.starttag(node, 'ul', **atts))+ self.body.append(self.starttag(node, 'ul', empty=True, **atts))The comment/explanation inside starttag() should be updated to say
"empty or list tag".
Thank you for reviewing! I missed the empty argument.
I updated my patch using it.
Actually, this does not work, because of side-effects (creating an empty tag with closing
like
, say
Instead, I suggest testing for "list-nodes" instead in starttag(). The html5-writer patch would become:
This is fixed in the repo. Thanks for reporting and patch.