@@ -164,27 +164,27 @@ def safe_markdown(value: Any) -> str:
164164 )
165165
166166
167- _PRECOMPILED_EXTENDS_PATTERN = re .compile (r"{% extends '.+?' %}|{% extends \".+?\" %}" )
168- _PRECOMPILED_BLOCK_PATTERN = re .compile (r"{% block \w+? %}" )
169- _PRECOMPILED_INCLUDE_PATTERN = re .compile (r"{% include '.+?' %}|{% include \".+?\" %}" )
170- _PRECOMPILED_HASH_COMMENT_PATTERN = re .compile (r"{# .+? #}" )
171- _PRECOMPILED_BLOCK_COMMENT_PATTERN = re .compile (
167+ _EXTENDS_PATTERN = re .compile (r"{% extends '.+?' %}|{% extends \".+?\" %}" )
168+ _BLOCK_PATTERN = re .compile (r"{% block \w+? %}" )
169+ _INCLUDE_PATTERN = re .compile (r"{% include '.+?' %}|{% include \".+?\" %}" )
170+ _HASH_COMMENT_PATTERN = re .compile (r"{# .+? #}" )
171+ _BLOCK_COMMENT_PATTERN = re .compile (
172172 r"{% comment ('.*?' |\".*?\" )?%}[\s\S]*?{% endcomment %}"
173173)
174- _PRECOMPILED_TOKEN_PATTERN = re .compile (r"{{ .+? }}|{% .+? %}" )
175- _PRECOMPILED_LSTRIP_BLOCK_PATTERN = re .compile (r"\n( )+$" )
174+ _TOKEN_PATTERN = re .compile (r"{{ .+? }}|{% .+? %}" )
175+ _LSTRIP_BLOCK_PATTERN = re .compile (r"\n( )+$" )
176176
177177
178178def _find_extends (template : str ):
179- return _PRECOMPILED_EXTENDS_PATTERN .search (template )
179+ return _EXTENDS_PATTERN .search (template )
180180
181181
182182def _find_block (template : str ):
183- return _PRECOMPILED_BLOCK_PATTERN .search (template )
183+ return _BLOCK_PATTERN .search (template )
184184
185185
186186def _find_include (template : str ):
187- return _PRECOMPILED_INCLUDE_PATTERN .search (template )
187+ return _INCLUDE_PATTERN .search (template )
188188
189189
190190def _find_named_endblock (template : str , name : str ):
@@ -318,11 +318,11 @@ def _replace_blocks_with_replacements(template: str, replacements: "dict[str, st
318318
319319
320320def _find_hash_comment (template : str ):
321- return _PRECOMPILED_HASH_COMMENT_PATTERN .search (template )
321+ return _HASH_COMMENT_PATTERN .search (template )
322322
323323
324324def _find_block_comment (template : str ):
325- return _PRECOMPILED_BLOCK_COMMENT_PATTERN .search (template )
325+ return _BLOCK_COMMENT_PATTERN .search (template )
326326
327327
328328def _remove_comments (
@@ -359,11 +359,11 @@ def _remove_matched_comment(template: str, comment_match: re.Match):
359359
360360
361361def _find_token (template : str ):
362- return _PRECOMPILED_TOKEN_PATTERN .search (template )
362+ return _TOKEN_PATTERN .search (template )
363363
364364
365365def _token_is_on_own_line (text_before_token : str ) -> bool :
366- return _PRECOMPILED_LSTRIP_BLOCK_PATTERN .search (text_before_token ) is not None
366+ return _LSTRIP_BLOCK_PATTERN .search (text_before_token ) is not None
367367
368368
369369def _create_template_function ( # pylint: disable=,too-many-locals,too-many-branches,too-many-statements
0 commit comments