From: Mark Hansen Date: Tue, 2 Jun 2020 11:25:54 +0000 (+1000) Subject: Use jinja2.PackageLoader X-Git-Tag: 2.44.1~22^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43c7d924fabc7b64ad476305d77617ba83157c7a;p=graphviz Use jinja2.PackageLoader This resolves the path to the templates/ folder relative to the python package (templates.py). The FileSystemLoader was relative to current working directory. After this, it doesn't matter what your current working directory is. --- diff --git a/doc/infosrc/templates.py b/doc/infosrc/templates.py index c3639aa4b..5b920c1a2 100644 --- a/doc/infosrc/templates.py +++ b/doc/infosrc/templates.py @@ -3,7 +3,10 @@ import jinja2 def env(): return jinja2.Environment( # Load template files from ./templates/ - loader=jinja2.FileSystemLoader('templates'), + loader=jinja2.PackageLoader( + package_name='templates', + package_path='templates', + ), # Auto-HTML-escape any html or xml files. autoescape=jinja2.select_autoescape(['html', 'xml', 'html.j2', 'xml.j2']), # Whitespace control