Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix signature of docutils include_source monkeypatch #11610

Merged
merged 2 commits into from Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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