Skip to content

Commit a62eefb

Browse files
committed
document
1 parent 0cc7169 commit a62eefb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pattern_library/monkey_utils.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,21 @@ def node_render(context):
9797

9898
return tag_func
9999

100+
# have to export the original jinja visit Extends
101+
# in the case jinja tags are being overriden
100102
jinja_visit_Extends = None
101103

102104
def override_jinja_tags():
105+
"""
106+
Overrides jinja extends and include tags for use in your pattern library.
107+
Call it in your settings to override tags
108+
"""
103109
global jinja_visit_Extends
104110
try:
105111
from jinja2.compiler import CodeGenerator as JinjaCodeGenerator
106112
from jinja2.environment import Template as JinjaTemplate
107113
except ModuleNotFoundError:
108-
ModuleNotFoundError("install jinja2 to override tags")
114+
ModuleNotFoundError("install jinja2 to override jinja tags")
109115

110116
from .loader_tags import template_new_context, visit_extends
111117
jinja_visit_Extends = JinjaCodeGenerator.visit_Extends

0 commit comments

Comments
 (0)