Closes #1323: Fix emitting empty `<ul>` tags in the HTML writer, which is not valid HTML.

This commit is contained in:
Georg Brandl 2014-01-19 18:21:23 +01:00
parent ce49286240
commit 7a74fe81b1
2 changed files with 9 additions and 0 deletions

View File

@ -119,6 +119,9 @@ Bugs fixed
* #1330: Fix :confval:`exclude_patterns` behavior with subdirectories in the
:confval:`html_static_path`.
* #1323: Fix emitting empty ``<ul>`` tags in the HTML writer, which is not
valid HTML.
Documentation
-------------

View File

@ -240,6 +240,12 @@ class HTMLTranslator(BaseTranslator):
self.body.append('.'.join(map(str, numbers)) +
self.secnumber_suffix)
# overwritten to avoid emitting empty <ul></ul>
def visit_bullet_list(self, node):
if len(node) == 1 and node[0].tagname == 'toctree':
raise nodes.SkipNode
BaseTranslator.visit_bullet_list(self, node)
# overwritten
def visit_title(self, node):
BaseTranslator.visit_title(self, node)