Welp, turns out this was crucial to correctly rendered doctrees.

Only impacts use of get_doctree(), aka invocations.release tasks.

Fixes #72
This commit is contained in:
Jeff Forcier 2017-10-19 17:08:43 -07:00
parent d5f397fe2c
commit f611196bc4

View file

@ -13,7 +13,7 @@ from docutils.nodes import bullet_list
from sphinx.application import Sphinx # not exposed at top level
# NOTE: importing these from environment for backwards compat with Sphinx 1.3
from sphinx.environment import (
SphinxStandaloneReader, SphinxFileInput, SphinxDummyWriter,
SphinxStandaloneReader, SphinxFileInput, SphinxDummyWriter, sphinx_domains,
)
from . import construct_releases, setup
@ -132,9 +132,14 @@ def get_doctree(path):
reader_kwargs = {
'app': app,
'parsers': env.config.source_parsers,
#'parsers': app.registry.get_source_parsers()
}
if sphinx.version_info[:2] < (1, 4):
del reader_kwargs['app']
# This monkeypatches (!!!) docutils to 'inject' all registered Sphinx
# domains' roles & so forth. Without this, rendering the doctree lacks
# almost all Sphinx magic, including things like :ref: and :doc:!
with sphinx_domains(env):
reader = SphinxStandaloneReader(**reader_kwargs)
pub = Publisher(reader=reader,
writer=SphinxDummyWriter(),