-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4827 from tk0miya/4784_latex_show_urls_and_substi…
…tutions Fix #4784: latex_show_urls assigns incorrect footnote numbers
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
sphinx.transforms.references | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Docutils transforms used by Sphinx. | ||
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. | ||
:license: BSD, see LICENSE for details. | ||
""" | ||
|
||
from docutils import nodes | ||
from docutils.transforms.references import Substitutions | ||
|
||
from sphinx.transforms import SphinxTransform | ||
|
||
|
||
class SubstitutionDefinitionsRemover(SphinxTransform): | ||
"""Remove ``substitution_definition node from doctrees. | ||
.. note:: In Sphinx-1.7, this transform is only used in LaTeX builder. | ||
""" | ||
|
||
# should be invoked after Substitutions process | ||
default_priority = Substitutions.default_priority + 1 | ||
|
||
def apply(self): | ||
# type: () -> None | ||
for node in self.document.traverse(nodes.substitution_definition): | ||
node.parent.remove(node) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -750,6 +750,15 @@ def test_latex_show_urls_is_no(app, status, warning): | |
'{[email protected]}\n') in result | ||
|
||
|
||
@pytest.mark.sphinx( | ||
'latex', testroot='footnotes', | ||
confoverrides={'latex_show_urls': 'footnote', | ||
'rst_prolog': '.. |URL| replace:: `text <http://www.example.com/>`__'}) | ||
def test_latex_show_urls_footnote_and_substitutions(app, status, warning): | ||
# hyperlinks in substitutions should not effect to make footnotes (refs: #4784) | ||
test_latex_show_urls_is_footnote(app, status, warning) | ||
|
||
|
||
@pytest.mark.sphinx('latex', testroot='image-in-section') | ||
def test_image_in_section(app, status, warning): | ||
app.builder.build_all() | ||
|