2013-07-27 00:13:15 -05:00
|
|
|
"""Test docutils.conf support for several writers."""
|
|
|
|
|
2024-11-22 15:54:26 -06:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2017-01-05 10:14:47 -06:00
|
|
|
import pytest
|
2019-02-08 09:36:25 -06:00
|
|
|
from docutils import nodes
|
2018-02-19 07:39:14 -06:00
|
|
|
|
2019-02-08 09:36:25 -06:00
|
|
|
from sphinx.testing.util import assert_node
|
2018-03-29 08:45:20 -05:00
|
|
|
from sphinx.util.docutils import patch_docutils
|
2013-07-27 00:13:15 -05:00
|
|
|
|
|
|
|
|
2024-08-11 08:58:56 -05:00
|
|
|
@pytest.mark.sphinx(
|
|
|
|
'dummy',
|
|
|
|
testroot='docutilsconf',
|
|
|
|
freshenv=True,
|
|
|
|
)
|
2024-07-23 09:35:55 -05:00
|
|
|
def test_html_with_default_docutilsconf(app):
|
2018-03-29 08:45:20 -05:00
|
|
|
with patch_docutils(app.confdir):
|
2019-02-08 09:36:25 -06:00
|
|
|
app.build()
|
2018-03-29 08:45:20 -05:00
|
|
|
|
2019-02-08 09:36:25 -06:00
|
|
|
doctree = app.env.get_doctree('index')
|
2024-08-11 08:58:56 -05:00
|
|
|
assert_node(
|
|
|
|
doctree[0][1], [nodes.paragraph, ('Sphinx ', [nodes.footnote_reference, '1'])]
|
|
|
|
)
|
2013-07-27 00:13:15 -05:00
|
|
|
|
|
|
|
|
2024-08-11 08:58:56 -05:00
|
|
|
@pytest.mark.sphinx(
|
|
|
|
'dummy',
|
|
|
|
testroot='docutilsconf',
|
|
|
|
freshenv=True,
|
|
|
|
docutils_conf='[restructuredtext parser]\ntrim_footnote_reference_space: true\n',
|
|
|
|
)
|
2024-07-23 09:35:55 -05:00
|
|
|
def test_html_with_docutilsconf(app):
|
2018-03-29 08:45:20 -05:00
|
|
|
with patch_docutils(app.confdir):
|
2019-02-08 09:36:25 -06:00
|
|
|
app.build()
|
2013-07-27 00:13:15 -05:00
|
|
|
|
2019-02-08 09:36:25 -06:00
|
|
|
doctree = app.env.get_doctree('index')
|
2024-08-11 08:58:56 -05:00
|
|
|
assert_node(
|
|
|
|
doctree[0][1], [nodes.paragraph, ('Sphinx', [nodes.footnote_reference, '1'])]
|
|
|
|
)
|