-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Formatting is turned off for the cli options block in `__init__.py` because I want them manually formatted and aligned for readability
- Loading branch information
Showing
6 changed files
with
67 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
from jinja2 import Environment, PackageLoader, select_autoescape | ||
from jinja2.loaders import FileSystemLoader | ||
from jinja2.loaders import FileSystemLoader, BaseLoader | ||
|
||
|
||
def render_html(config, template_dir_override=None) -> str: | ||
loader: BaseLoader | ||
|
||
if template_dir_override: | ||
loader = FileSystemLoader(template_dir_override) | ||
else: | ||
loader = PackageLoader("adr_viewer", "templates") | ||
|
||
env = Environment( | ||
loader=PackageLoader('adr_viewer', 'templates') if template_dir_override is None else FileSystemLoader(template_dir_override), | ||
autoescape=select_autoescape(['html', 'xml']) | ||
loader=loader, | ||
autoescape=select_autoescape(["html", "xml"]), | ||
) | ||
|
||
template = env.get_template('index.html') | ||
template = env.get_template("index.html") | ||
|
||
return template.render(config=config) | ||
return template.render(config=config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters