1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-09 19:54:17 +00:00

implement recursive variables for #83

This commit is contained in:
deadc0de6
2019-02-02 20:16:44 +01:00
parent 45f29679b2
commit 8e9f1b2468
5 changed files with 197 additions and 15 deletions

View File

@@ -57,6 +57,10 @@ class Templategen:
return ''
return self.env.from_string(string).render()
def update_variables(self, variables):
"""update variables"""
self.env.globals.update(variables)
def _header(self, prepend=''):
"""add a comment usually in the header of a dotfile"""
return '{}{}'.format(prepend, utils.header())
@@ -125,6 +129,11 @@ class Templategen:
return True
return False
@staticmethod
def var_is_template(string):
"""check if variable contains template(s)"""
return VAR_START in str(string)
@staticmethod
def _is_template(path):
"""test if file pointed by path is a template"""