Skip to content

Commit

Permalink
Make jinja2 search in user specified directory for templates before
Browse files Browse the repository at this point in the history
default ford shipped templates
  • Loading branch information
daviddickinson committed Nov 13, 2024
1 parent daf9903 commit 7d5d3ba
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ford/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

loc = pathlib.Path(__file__).parent
env = jinja2.Environment(
loader=jinja2.FileSystemLoader(loc / "templates"),
trim_blocks=True,
lstrip_blocks=True,
)
Expand Down Expand Up @@ -120,6 +119,10 @@ def __init__(self, settings: ProjectSettings, proj_docs: str, project, pagetree)
# Also, in future for other template, we may not need to
# pass the data obj.
env.globals["projectData"] = asdict(settings)
env.loader=jinja2.FileSystemLoader(
settings.html_template_dir + [loc / "templates"]
)

self.project = project
self.settings = settings
# Jinja2's `if` statement counts `None` as truthy, so to avoid
Expand Down

0 comments on commit 7d5d3ba

Please sign in to comment.