diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-05-12 08:52:03 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-05-12 10:07:04 +0300 |
commit | ab668396fc449ecba7788338ea4357fc99dde158 (patch) | |
tree | 5821b5053614a0da46a922234adfc63e8edc44f1 /sphinx/io.py | |
parent | 0d1a66996bf930df37404f9f7cb097407c7673eb (diff) |
Fix #6351: "Hyperlink target is not referenced" message is shown even if referenced
Diffstat (limited to 'sphinx/io.py')
-rw-r--r-- | sphinx/io.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sphinx/io.py b/sphinx/io.py index b5b57d065..5f4ec3351 100644 --- a/sphinx/io.py +++ b/sphinx/io.py @@ -16,6 +16,7 @@ from docutils.io import FileInput, NullOutput from docutils.parsers.rst import Parser as RSTParser from docutils.readers import standalone from docutils.statemachine import StringList, string2lines +from docutils.transforms.references import DanglingReferences from docutils.writers import UnfilteredWriter from sphinx.deprecation import RemovedInSphinx30Warning @@ -64,7 +65,15 @@ class SphinxBaseReader(standalone.Reader): def get_transforms(self): # type: () -> List[Type[Transform]] - return super().get_transforms() + self.transforms + transforms = super().get_transforms() + self.transforms + + # remove transforms which is not needed for Sphinx + unused = [DanglingReferences] + for transform in unused: + if transform in transforms: + transforms.remove(transform) + + return transforms def new_document(self): # type: () -> nodes.document |