Templating¶
- class narrenschiff.templating.Template(*args, **kwargs)[source]¶
Load and manipulate templates and template environment.
- clear_templates()[source]¶
Delete all templates from the
/tmp
directory.- Returns
Void
- Return type
None
- find_duplicates(values)[source]¶
Find duplicate keys.
- Parameters
values (
list
ofstr
) – List of keys from var and chest files.- Returns
List of duplicates
- Return type
list
ofstr
- load_vars()[source]¶
Load variables.
- Returns
Variables to be used for template rendering
- Return type
dict
This is the order in which files containing variables are loaded:
Load
vars.yaml
if it existsLoad all files from the
vars/
directory if it existsLoad and decrypt all variables from
chest.yaml
Load all files from the
chest/
directory if it existsLoad all variables from
secretmap.yaml
Merge all files
Important: Files must not contain duplicate variable names!
- render(path)[source]¶
Render template on the given path.
- Parameters
path (
str
) – Path to the template file- Returns
Rendered template
- Return type
str
- exception narrenschiff.templating.TemplateException[source]¶
Use for exceptions regarding template manipulation.