diff --git a/docs/user_guide/project_file_options.rst b/docs/user_guide/project_file_options.rst index 2150f933..945e352c 100644 --- a/docs/user_guide/project_file_options.rst +++ b/docs/user_guide/project_file_options.rst @@ -427,6 +427,18 @@ directory that starts with ``test`` anywhere in the source directory tree. exclude_dir: **/test* src/internal +.. _option-html_template_dir: + +html_template_dir +^^^^^^^^^^^^^^^^^ + +A list of directories to search for HTML templates. + +.. caution:: This is an experimental feature! + + You will most likely want to copy-paste the existing templates and + modify them. They are not well documented, so use at your own risk! + .. _option-include: include diff --git a/ford/output.py b/ford/output.py index 13c0ba21..0f958209 100644 --- a/ford/output.py +++ b/ford/output.py @@ -45,7 +45,6 @@ loc = pathlib.Path(__file__).parent env = jinja2.Environment( - loader=jinja2.FileSystemLoader(loc / "templates"), trim_blocks=True, lstrip_blocks=True, ) @@ -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 diff --git a/ford/settings.py b/ford/settings.py index 40e275ef..373e700b 100644 --- a/ford/settings.py +++ b/ford/settings.py @@ -161,6 +161,7 @@ class ProjectSettings: graph_maxdepth: int = 10000 graph_maxnodes: int = 1000000000 hide_undoc: bool = False + html_template_dir: List[Path] = field(default_factory=list) incl_src: bool = True include: List[Path] = field(default_factory=list) license: str = ""