Skip to content

Commit

Permalink
add new hook for Jinja2 extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
llange authored and kpfleming committed Apr 27, 2024
1 parent afc29d0 commit 0091b60
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Features:
* Jinja2 templating
* INI, YAML, JSON data sources supported
* Environment variables can be used with or without data files
* Plugins can provide additional formats, filters, tests, and global
* Plugins can provide additional formats, filters, tests, extensions and global
functions (see
[jinjanator-plugins](https://github.com/kpfleming/jinjanator-plugins)
for details)
Expand Down
4 changes: 4 additions & 0 deletions src/jinjanator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ def __init__(
for plugin_tests in plugin_hook_callers.plugin_tests():
self._env.tests.update(plugin_tests)

for plugin_extensions in plugin_hook_callers.plugin_extensions():
for extension in plugin_extensions:
self._env.add_extension(extension)

def render(self, template_name: str, context: Mapping[str, str]) -> str:
return self._env.get_template(template_name).render(context)

Expand Down

0 comments on commit 0091b60

Please sign in to comment.