Discussion:
[Docutils-users] numbered footnotes?
Matěj Cepl
2013-10-29 23:21:07 UTC
Permalink
Hi,

what I am doing wrong that I don't have properly numbered footnotes here
(with docutils python-docutils-0.11-0.1.20130715svn7687 with a Fedora
package).

This is the rST source code:

***@wycliff: ~$ cat test.rst
This is a body of text.[#]_

.. [#] This is a body of footnote.
***@wycliff: ~$

and this is the result of running it through rst2html:

***@wycliff: ~$ rst2html --link-stylesheet \
--trim-footnote-reference-space --footnote-backlinks test.rst
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.11:
http://docutils.sourceforge.net/" />
<title></title>
<link rel="stylesheet"
href="/usr/lib/python2.7/site-packages/docutils/writers/html4css1/html4css1.css"
type="text/css" />
</head>
<body>
<div class="document">


<p>This is a body of text.[#]_</p>
<table class="docutils footnote" frame="void" id="id1" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[1]</td><td>This is a body of footnote.</td></tr>
</tbody>
</table>
</div>
</body>
</html>
***@wycliff: ~$

Obviously, the reference to the footnote has not been created properly,
and it is still just [#]_

The similar result I get when I explicitly state the number (i.e.,
[1]_). Again footnote is not generated and explicit code from rST is used.

What I am doing wrong? Can rst2html generate footnotes?

Best,

Matěj
--
http://www.ceplovi.cz/matej/, Jabber: ***@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

I would like to die sleeping, like my father -- rather than
screaming and helpless, like his passengers.
Guenter Milde
2013-10-30 10:40:39 UTC
Permalink
Post by Matěj Cepl
Hi,
what I am doing wrong that I don't have properly numbered footnotes here
(with docutils python-docutils-0.11-0.1.20130715svn7687 with a Fedora
package).
This is a body of text.[#]_
.. [#] This is a body of footnote.
You need a space before the footnote::

This is a body of text. [#]_

If you don't want the space in the output, escape it ::

This is a body of text.\ [#]_

or set trim-footnote-reference-space
http://docutils.sourceforge.net/docs/user/config.html#trim-footnote-reference-space
to True.

Günter

Loading...