summaryrefslogtreecommitdiff
path: root/sphinx/writers/xml.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-07-04 01:28:35 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-07-04 01:28:37 +0900
commit4aa222e7f9dc48dd016098f8c2bf86402faacd65 (patch)
tree9f1807a06c6f0b62d06cad71c8e3a924d780584a /sphinx/writers/xml.py
parentbc616d3b1a2c0c41ef6fb4e27181cf2b177f02fb (diff)
downloadsphinx-git-4aa222e7f9dc48dd016098f8c2bf86402faacd65.tar.gz
Fix #9387: xml: XML Builder ignores custom visitors
So far, XML builder only allows to switch its translator to custom one. But it does not support to install custom visitor methods. This allows to use them expectedly.
Diffstat (limited to 'sphinx/writers/xml.py')
-rw-r--r--sphinx/writers/xml.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sphinx/writers/xml.py b/sphinx/writers/xml.py
index 19fa3c1ef..ef261fde2 100644
--- a/sphinx/writers/xml.py
+++ b/sphinx/writers/xml.py
@@ -19,7 +19,9 @@ class XMLWriter(BaseXMLWriter):
def __init__(self, builder: Builder) -> None:
super().__init__()
self.builder = builder
- self.translator_class = self.builder.get_translator_class()
+
+ # A lambda function to generate translator lazily
+ self.translator_class = lambda document: self.builder.create_translator(document)
def translate(self, *args: Any, **kwargs: Any) -> None:
self.document.settings.newlines = \