Skip to content

Commit

Permalink
🐛 FIX: Ensure parent files are re-built if include file changes (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell authored Dec 4, 2021
1 parent 4c8aebe commit 89ad170
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions myst_parser/mocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,15 @@ def run(self) -> List[nodes.Element]:
# i.e. relative to source directory
try:
sphinx_env = self.document.settings.env
_, include_arg = sphinx_env.relfn2path(self.arguments[0])
sphinx_env.note_included(include_arg)
except AttributeError:
pass
else:
_, include_arg = sphinx_env.relfn2path(self.arguments[0])
sphinx_env.note_included(include_arg)
path = Path(include_arg)
path = source_dir.joinpath(path)
# this ensures that the parent file is rebuilt if the included file changes
self.document.settings.record_dependencies.add(str(path))

# read file
encoding = self.options.get("encoding", self.document.settings.input_encoding)
Expand Down

0 comments on commit 89ad170

Please sign in to comment.