Skip to content

Commit

Permalink
Fix signature of docutils include_source monkeypatch (#11610)
Browse files Browse the repository at this point in the history
  • Loading branch information
ksunden committed Aug 17, 2023
1 parent 441a9e4 commit b38d185
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sphinx/directives/other.py
Expand Up @@ -377,7 +377,7 @@ def run(self) -> list[Node]:
# In the future, docutils will hopefully offer a way for Sphinx
# to provide the RST parser to use
# when parsing RST text that comes in via Include directive.
def _insert_input(include_lines, path):
def _insert_input(include_lines, source):
# First, we need to combine the lines back into text so that
# we can send it with the source-read event.
# In docutils 0.18 and later, there are two lines at the end
Expand All @@ -386,7 +386,7 @@ def _insert_input(include_lines, path):
text = "\n".join(include_lines[:-2])

# The docname to pass into the source-read event
docname = self.env.path2doc(os_path(path))
docname = self.env.path2doc(os_path(source))
# Emit the "source-read" event
arg = [text]
self.env.app.events.emit("source-read", docname, arg)
Expand All @@ -398,7 +398,7 @@ def _insert_input(include_lines, path):
# Call the parent implementation.
# Note that this snake does not eat its tail because we patch
# the *Instance* method and this call is to the *Class* method.
return StateMachine.insert_input(self.state_machine, include_lines, path)
return StateMachine.insert_input(self.state_machine, include_lines, source)

# Only enable this patch if there are listeners for 'source-read'.
if self.env.app.events.listeners.get('source-read'):
Expand Down

0 comments on commit b38d185

Please sign in to comment.