Skip to content

Commit

Permalink
🐛 FIX: Image URI issue for latex build when source has subdirectories (
Browse files Browse the repository at this point in the history
…#368)

* handling subdirectory in generating image

* checking path in rtd

* checking path in rtd

* abspath instead
  • Loading branch information
AakashGfude committed Oct 23, 2021
1 parent 5d31ac4 commit 2baade0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions myst_nb/render_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,10 @@ def _render_image(output: NotebookNode, index: int):
# directory, so make a relative path, which Sphinx treats
# as being relative to the current working directory.
filename = os.path.basename(output.metadata["filenames"][mime_type])

# checks if file dir path is inside a subdir of dir
filedir = os.path.dirname(output.metadata["filenames"][mime_type])
subpaths = filedir.split(self.sphinx_dir)
outbasedir = os.path.abspath(self.sphinx_dir)
subpaths = filedir.split(outbasedir)
final_dir = self.sphinx_dir
if subpaths and len(subpaths) > 1:
subpath = subpaths[1]
Expand Down

0 comments on commit 2baade0

Please sign in to comment.