Skip to content

Commit 6b7a763

Browse files
Allow nested templates for root (#13)
When rendering jinja templates for the root directory and writing them to the build destination, a `FileNotFoundError` could be encountered. This is because the code only ensured the existance of the output directory but not of any subfolders templates might be placed into. This PR fixes this and creates the missing subdirectories when necessary.
2 parents 6257207 + 6b55ebd commit 6b7a763

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sphinx_polyversion/driver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,4 +678,5 @@ async def build_root(self) -> None:
678678
template = env.get_template(template_path_str)
679679
rendered = template.render(context)
680680
output_path = self.output_dir / template_path_str
681+
output_path.parent.mkdir(parents=True, exist_ok=True)
681682
output_path.write_text(rendered)

0 commit comments

Comments
 (0)