summaryrefslogtreecommitdiff
path: root/sphinx/testing
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-03-09 16:35:47 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-08-20 21:45:50 +0900
commit21cd1c2ef52699194a1ced02714681198c04b89d (patch)
tree66e86b236a6e76fbf67b46e3dc2162b1ae81b583 /sphinx/testing
parent63757596b14991801ce09d1ac9bff425715e0c40 (diff)
downloadsphinx-git-21cd1c2ef52699194a1ced02714681198c04b89d.tar.gz
refactor: SphinxStandaloneReader should not hold an application object
Diffstat (limited to 'sphinx/testing')
-rw-r--r--sphinx/testing/restructuredtext.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sphinx/testing/restructuredtext.py b/sphinx/testing/restructuredtext.py
index 1da8d9a60..1c3a149ad 100644
--- a/sphinx/testing/restructuredtext.py
+++ b/sphinx/testing/restructuredtext.py
@@ -21,11 +21,13 @@ def parse(app: Sphinx, text: str, docname: str = 'index') -> nodes.document:
"""Parse a string as reStructuredText with Sphinx application."""
try:
app.env.temp_data['docname'] = docname
+ reader = SphinxStandaloneReader()
+ reader.setup(app)
parser = RSTParser()
parser.set_application(app)
with sphinx_domains(app.env):
return publish_doctree(text, path.join(app.srcdir, docname + '.rst'),
- reader=SphinxStandaloneReader(app),
+ reader=reader,
parser=parser,
settings_overrides={'env': app.env,
'gettext_compact': True})