1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-07 12:48:32 +00:00

adding ability to use variables from the config file in templates

This commit is contained in:
deadc0de6
2018-09-01 18:28:53 +02:00
parent 9f3da3c8b7
commit 8a3e7459f3
7 changed files with 137 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ COMMENT_END = '@@#}'
class Templategen:
def __init__(self, base='.', debug=False):
def __init__(self, base='.', variables={}, debug=False):
self.base = base.rstrip(os.sep)
self.debug = debug
loader = FileSystemLoader(self.base)
@@ -36,6 +36,7 @@ class Templategen:
comment_start_string=COMMENT_START,
comment_end_string=COMMENT_END)
self.env.globals['header'] = self._header
self.env.globals.update(variables)
self.log = Logger()
def generate(self, src, profile):