marianoguerra/rst2html5 — pull request #39 by ntamas (2013-10-08 09:40:54+00:00)
Title: fix placement of <span> tags for additional ids

`rst2html5` places `` tags containing additional IDs for a section incorrectly (after the closing `

` tag instead of right at the beginning of the `

`). Also, `rst2html5` creates unnecessary empty `` tags after inline internal references. This patch fixes both issues.

To reproduce the issues, try filtering the following document through an unpatched `rst2html5`:

```rst
.. _foo:

First section
-------------

Second section
--------------

Third section
-------------

`This link`_ should lead back to the first section but leads to the second
section instead using ``rst2html5``. It works as expected using ``rst2html``.

.. _This link: foo_
```

`rst2html5` produces the following HTML output (irrelevant parts omitted):

```html

First section

Second section

Third section

This link should lead back to the first section but leads to the second section instead using rst2html5. It works as expected using rst2html.

```

Note the misplaced `` which appears before the second section and not before the first one. Also note the extra `` tags.

After patching `rst2html5` according to this pull request, the following (correct) output is produced:

```html

First section

Second section

Third section

This link should lead back to the first section but leads to the second section instead using rst2html5. It works as expected using rst2html.

```