@@ -164,27 +164,27 @@ def safe_markdown(value: Any) -> str:
164
164
)
165
165
166
166
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 (
172
172
r"{% comment ('.*?' |\".*?\" )?%}[\s\S]*?{% endcomment %}"
173
173
)
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( )+$" )
176
176
177
177
178
178
def _find_extends (template : str ):
179
- return _PRECOMPILED_EXTENDS_PATTERN .search (template )
179
+ return _EXTENDS_PATTERN .search (template )
180
180
181
181
182
182
def _find_block (template : str ):
183
- return _PRECOMPILED_BLOCK_PATTERN .search (template )
183
+ return _BLOCK_PATTERN .search (template )
184
184
185
185
186
186
def _find_include (template : str ):
187
- return _PRECOMPILED_INCLUDE_PATTERN .search (template )
187
+ return _INCLUDE_PATTERN .search (template )
188
188
189
189
190
190
def _find_named_endblock (template : str , name : str ):
@@ -318,11 +318,11 @@ def _replace_blocks_with_replacements(template: str, replacements: "dict[str, st
318
318
319
319
320
320
def _find_hash_comment (template : str ):
321
- return _PRECOMPILED_HASH_COMMENT_PATTERN .search (template )
321
+ return _HASH_COMMENT_PATTERN .search (template )
322
322
323
323
324
324
def _find_block_comment (template : str ):
325
- return _PRECOMPILED_BLOCK_COMMENT_PATTERN .search (template )
325
+ return _BLOCK_COMMENT_PATTERN .search (template )
326
326
327
327
328
328
def _remove_comments (
@@ -359,11 +359,11 @@ def _remove_matched_comment(template: str, comment_match: re.Match):
359
359
360
360
361
361
def _find_token (template : str ):
362
- return _PRECOMPILED_TOKEN_PATTERN .search (template )
362
+ return _TOKEN_PATTERN .search (template )
363
363
364
364
365
365
def _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
367
367
368
368
369
369
def _create_template_function ( # pylint: disable=,too-many-locals,too-many-branches,too-many-statements
0 commit comments