Skip to content

Commit e369f8b

Browse files
edcohen08thibaudcolas
authored andcommitted
document
1 parent a9c9d30 commit e369f8b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pattern_library/monkey_utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,21 @@ def node_render(context):
118118

119119
return tag_func
120120

121+
# have to export the original jinja visit Extends
122+
# in the case jinja tags are being overriden
121123
jinja_visit_Extends = None
122124

123125
def override_jinja_tags():
126+
"""
127+
Overrides jinja extends and include tags for use in your pattern library.
128+
Call it in your settings to override tags
129+
"""
124130
global jinja_visit_Extends
125131
try:
126132
from jinja2.compiler import CodeGenerator as JinjaCodeGenerator
127133
from jinja2.environment import Template as JinjaTemplate
128134
except ModuleNotFoundError:
129-
ModuleNotFoundError("install jinja2 to override tags")
135+
ModuleNotFoundError("install jinja2 to override jinja tags")
130136

131137
from .loader_tags import template_new_context, visit_extends
132138
jinja_visit_Extends = JinjaCodeGenerator.visit_Extends

0 commit comments

Comments
 (0)