diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2021-11-13 10:58:09 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-11-13 11:14:31 -0500 |
commit | 338b75544b320d538a8b116c2b8416e08e216003 (patch) | |
tree | 6df2e73e548bbe0cca7afc05399cd0adb32a124a /mako | |
parent | 9b79bf0e1e74dc9f95c934302ca606856d6c4470 (diff) | |
download | mako-338b75544b320d538a8b116c2b8416e08e216003.tar.gz |
Fix matching multiline control lines in templates with CRLF line endings
Fixed issue where control statements on multi lines with a backslash would
not parse correctly if the template itself contained CR/LF pairs as on
Windows. Pull request courtesy Charles Pigott.
A missing '\\' meant that it would actually allow
```
% if foo \r
bar:
```
in a template file and not match if the file actually had a `\r` char
Closes: #346
Pull-request: https://github.com/sqlalchemy/mako/pull/346
Pull-request-sha: e79ebabe3df7e59c9ea40e62406131e1a0c6c3b4
Change-Id: I179bdd661cecb1ffb3cf262e31183c8e83d98f12
Diffstat (limited to 'mako')
-rw-r--r-- | mako/lexer.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mako/lexer.py b/mako/lexer.py index 953c0a0..527c4b5 100644 --- a/mako/lexer.py +++ b/mako/lexer.py @@ -420,7 +420,7 @@ class Lexer: def match_control_line(self): match = self.match( - r"(?<=^)[\t ]*(%(?!%)|##)[\t ]*((?:(?:\\r?\n)|[^\r\n])*)" + r"(?<=^)[\t ]*(%(?!%)|##)[\t ]*((?:(?:\\\r?\n)|[^\r\n])*)" r"(?:\r?\n|\Z)", re.M, ) |