mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Change priority of sphinx-domains
This commit is contained in:
parent
765aec565d
commit
5e4da90ffa
4
CHANGES
4
CHANGES
@ -17,8 +17,8 @@ Incompatible changes
|
|||||||
a ``conf.py`` file sphinx-build generates.
|
a ``conf.py`` file sphinx-build generates.
|
||||||
* The ``gettext_compact`` attribute is removed from ``document.settings``
|
* The ``gettext_compact`` attribute is removed from ``document.settings``
|
||||||
object. Please use ``config.gettext_compact`` instead.
|
object. Please use ``config.gettext_compact`` instead.
|
||||||
* The order of smart_quotes is changed. For more detail, please read a
|
* The processing order of smart_quotes and sphinx domains are changed. For more
|
||||||
description of :py:meth:`.Sphinx.add_transform()`
|
details, please read a description of :py:meth:`.Sphinx.add_transform()`
|
||||||
|
|
||||||
Deprecated
|
Deprecated
|
||||||
----------
|
----------
|
||||||
|
@ -21,7 +21,7 @@ from os import path
|
|||||||
|
|
||||||
from docutils.frontend import OptionParser
|
from docutils.frontend import OptionParser
|
||||||
from docutils.utils import Reporter, get_source_line
|
from docutils.utils import Reporter, get_source_line
|
||||||
from six import BytesIO, itervalues, class_types, next
|
from six import BytesIO, class_types, next
|
||||||
from six.moves import cPickle as pickle
|
from six.moves import cPickle as pickle
|
||||||
|
|
||||||
from sphinx import addnodes, versioning
|
from sphinx import addnodes, versioning
|
||||||
@ -570,10 +570,6 @@ class BuildEnvironment(object):
|
|||||||
with sphinx_domains(self), rst.default_role(docname, self.config.default_role):
|
with sphinx_domains(self), rst.default_role(docname, self.config.default_role):
|
||||||
doctree = read_doc(self.app, self, self.doc2path(docname))
|
doctree = read_doc(self.app, self, self.doc2path(docname))
|
||||||
|
|
||||||
# post-processing
|
|
||||||
for domain in itervalues(self.domains):
|
|
||||||
domain.process_doc(self, docname, doctree)
|
|
||||||
|
|
||||||
# allow extension-specific post-processing
|
# allow extension-specific post-processing
|
||||||
if app:
|
if app:
|
||||||
app.emit('doctree-read', doctree)
|
app.emit('doctree-read', doctree)
|
||||||
|
@ -31,6 +31,7 @@ from sphinx.transforms.compact_bullet_list import RefOnlyBulletListTransform
|
|||||||
from sphinx.transforms.i18n import (
|
from sphinx.transforms.i18n import (
|
||||||
PreserveTranslatableMessages, Locale, RemoveTranslatableInline,
|
PreserveTranslatableMessages, Locale, RemoveTranslatableInline,
|
||||||
)
|
)
|
||||||
|
from sphinx.transforms.references import SphinxDomains
|
||||||
from sphinx.util import logging
|
from sphinx.util import logging
|
||||||
from sphinx.util.docutils import LoggingReporter
|
from sphinx.util.docutils import LoggingReporter
|
||||||
|
|
||||||
@ -93,7 +94,8 @@ class SphinxStandaloneReader(SphinxBaseReader):
|
|||||||
Locale, CitationReferences, DefaultSubstitutions, MoveModuleTargets,
|
Locale, CitationReferences, DefaultSubstitutions, MoveModuleTargets,
|
||||||
HandleCodeBlocks, AutoNumbering, AutoIndexUpgrader, SortIds,
|
HandleCodeBlocks, AutoNumbering, AutoIndexUpgrader, SortIds,
|
||||||
RemoveTranslatableInline, FilterSystemMessages, RefOnlyBulletListTransform,
|
RemoveTranslatableInline, FilterSystemMessages, RefOnlyBulletListTransform,
|
||||||
UnreferencedFootnotesDetector, SphinxSmartQuotes, ManpageLink
|
UnreferencedFootnotesDetector, SphinxSmartQuotes, ManpageLink,
|
||||||
|
SphinxDomains,
|
||||||
] # type: List[Transform]
|
] # type: List[Transform]
|
||||||
|
|
||||||
def __init__(self, app, *args, **kwargs):
|
def __init__(self, app, *args, **kwargs):
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
from docutils import nodes
|
from docutils import nodes
|
||||||
from docutils.transforms.references import Substitutions
|
from docutils.transforms.references import Substitutions
|
||||||
|
from six import itervalues
|
||||||
|
|
||||||
from sphinx.transforms import SphinxTransform
|
from sphinx.transforms import SphinxTransform
|
||||||
|
|
||||||
@ -28,3 +29,13 @@ class SubstitutionDefinitionsRemover(SphinxTransform):
|
|||||||
# type: () -> None
|
# type: () -> None
|
||||||
for node in self.document.traverse(nodes.substitution_definition):
|
for node in self.document.traverse(nodes.substitution_definition):
|
||||||
node.parent.remove(node)
|
node.parent.remove(node)
|
||||||
|
|
||||||
|
|
||||||
|
class SphinxDomains(SphinxTransform):
|
||||||
|
"""Collect objects to Sphinx domains for cross references."""
|
||||||
|
default_priority = 850
|
||||||
|
|
||||||
|
def apply(self):
|
||||||
|
# type: () -> None
|
||||||
|
for domain in itervalues(self.env.domains):
|
||||||
|
domain.process_doc(self, self.env.docname, self.document)
|
||||||
|
Loading…
Reference in New Issue
Block a user