- Even the Docutils HTML5 writer was putting *frightening* :html:`<colgroup>`
things into HTML tables. Not anymore.
- Topics are using HTML5 :html:`<aside>` tag, topic headers are using
- :html:`<h3>` instead of a nondescript :html:`<div>`
+ :html:`<h3>` instead of a nondescript :html:`<div>`. A special case is
+ Table of Contents, which is a :html:`<nav>` instead of :html:`<aside>`
- Line blocks are simply :html:`<p>` elements with lines delimited using
:html:`<br>`
- The :html:`<abbr>` tag now properly includes a ``title`` attribute
self.body.append('\n')
self.in_mailto = False
- # Use <aside> instead of a meaningless <div>
+ # Use <aside> for general topics, <nav> for table of contents (but drop the
+ # contents class and ID)
def visit_topic(self, node):
- self.body.append(self.starttag(node, 'aside'))
self.topic_classes = node['classes']
+ if 'contents' in node['classes']:
+ node.html_tagname = 'nav'
+ node['classes'].remove('contents')
+ node['ids'].remove('contents')
+ else:
+ node.html_tagname = 'aside'
+
+ self.body.append(self.starttag(node, node.html_tagname))
+
def depart_topic(self, node):
- self.body.append('</aside>\n')
+ self.body.append('</{}>\n'.format(node.html_tagname))
self.topic_classes = []
# Don't use <colgroup> or other shit in tables
<div class="m-col-l-10 m-push-l-1">
<h1>A page</h1>
<!-- content -->
-<aside class="contents m-block m-default" id="contents">
+<nav class="m-block m-default">
<h3>Contents</h3>
<ul>
<li><a href="#section-title" id="id6">Section title</a><ul>
</li>
<li><a href="#section-after" id="id8">Section after</a></li>
</ul>
-</aside>
+</nav>
<p>A paragraph.</p>
<blockquote>
A block quote.</blockquote>