def depart_line(self, node):
self.body.append('<br />\n')
+ # Footnote list. Replacing the classes with just .m-footnote.
+ def visit_footnote(self, node):
+ if not self.in_footnote_list:
+ self.body.append('<dl class="m-footnote">\n')
+ self.in_footnote_list = True
+
+ def depart_footnote(self, node):
+ self.body.append('</dd>\n')
+ if not isinstance(node.next_node(descend=False, siblings=True),
+ nodes.footnote):
+ self.body.append('</dl>\n')
+ self.in_footnote_list = False
+
+ # Footnote reference
+ def visit_footnote_reference(self, node):
+ href = '#' + node['refid']
+ self.body.append(self.starttag(node, 'a', '', CLASS='m-footnote', href=href))
+
+ def depart_footnote_reference(self, node):
+ self.body.append('</a>')
+
+ # Footnote and citation labels
+ def visit_label(self, node):
+ self.body.append(self.starttag(node.parent, 'dt', ''))
+
+ def depart_label(self, node):
+ if self.settings.footnote_backlinks:
+ backrefs = node.parent['backrefs']
+ if len(backrefs) == 1:
+ self.body.append('</a>')
+ self.body.append('.</dt>\n<dd><span class="m-footnote">')
+ if len(backrefs) == 1:
+ self.body.append('<a href="#{}">^</a>'.format(backrefs[0]))
+ else:
+ self.body.append('^ ')
+ self.body.append(format(' '.join('<a href="#{}">{}</a>'.format(ref, chr(ord('a') + i)) for i, ref in enumerate(backrefs))))
+ self.body.append('</span> ')
+
def visit_line_block(self, node):
self.body.append(self.starttag(node, 'p'))
<aside class="contents m-block m-default" id="contents">
<h3>Contents</h3>
<ul>
-<li><a href="#section-title" id="id3">Section title</a><ul>
-<li><a href="#section-title-with-link" id="id4">Section title with link</a></li>
+<li><a href="#section-title" id="id6">Section title</a><ul>
+<li><a href="#section-title-with-link" id="id7">Section title with link</a></li>
</ul>
</li>
</ul>
<dd>Description of term 2</dd>
</dl>
<section id="section-title">
-<h2><a class="toc-backref" href="#id3">Section title</a></h2>
+<h2><a class="toc-backref" href="#id6">Section title</a></h2>
<p>An <em>emphasised text</em>, <strong>strong text</strong> and a <code>literal</code>. Link to
<a href="https://google.com">Google</a>, <a href="#a-heading">the heading below</a> or just an
URL as-is: <a href="https://mcss.mosra.cz/">https://mcss.mosra.cz/</a>. <a href="mailto:mosra@centrum.cz">E-mail</a>. A footnote
-reference: <a class="footnote-reference brackets" href="#id2" id="id1">1</a></p>
-<dl class="footnote brackets">
-<dt class="label" id="id2"><span class="brackets"><a class="fn-backref" href="#id1">1</a></span></dt>
-<dd>A footnote description</dd>
+reference on a single thing <a class="m-footnote" href="#id4" id="id1">1</a> and more things <a class="m-footnote" href="#id4" id="id2">1</a> <a class="m-footnote" href="#id5" id="id3">2</a></p>
+<dl class="m-footnote">
+<dt id="id4">1.</dt>
+<dd><span class="m-footnote">^ <a href="#id1">a</a> <a href="#id2">b</a></span> A footnote description</dd>
+<dt id="id5">2</a>.</dt>
+<dd><span class="m-footnote"><a href="#id3">^</a></span> Second thing description</dd>
</dl>
<section id="section-title-with-link">
<h3><a href="#section-title-with-link">Section title with link</a></h3>
An *emphasised text*, **strong text** and a ``literal``. Link to
`Google <https://google.com>`_, `the heading below <#a-heading>`_ or just an
URL as-is: https://mcss.mosra.cz/. `E-mail <mosra@centrum.cz>`_. A footnote
-reference: [1]_
+reference on a single thing [1]_ and more things [1]_ [2]_
.. [1] A footnote description
+.. [2] Second thing description
`Section title with link`_
--------------------------