aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mako/lexer.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-01-29 00:23:16 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-01-29 00:23:16 +0000
commit833ef69d6dfbd1202b615b20a6e0c6879dda23c4 (patch)
tree9cef836a6ddd9b58cfd1ffc9c349c801b88b0074 /lib/mako/lexer.py
parent7fce0b7e0d76a72b15e4385fec5bb3b8a2cbcfeb (diff)
downloadexternal_python_mako-833ef69d6dfbd1202b615b20a6e0c6879dda23c4.tar.gz
external_python_mako-833ef69d6dfbd1202b615b20a6e0c6879dda23c4.tar.bz2
external_python_mako-833ef69d6dfbd1202b615b20a6e0c6879dda23c4.zip
- support for CRLF templates...whoops ! welcome to all the windows users.
[ticket:16] - cleanup in unit tests
Diffstat (limited to 'lib/mako/lexer.py')
-rw-r--r--lib/mako/lexer.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/mako/lexer.py b/lib/mako/lexer.py
index 5b6e97d..ee3309d 100644
--- a/lib/mako/lexer.py
+++ b/lib/mako/lexer.py
@@ -131,7 +131,7 @@ class Lexer(object):
return self.template
def match_encoding(self):
- match = self.match(r'#.*coding[:=]\s*([-\w.]+).*\n')
+ match = self.match(r'#.*coding[:=]\s*([-\w.]+).*\r?\n')
if match:
return match.group(1)
else:
@@ -209,7 +209,7 @@ class Lexer(object):
(?=</?[%&]) # a substitution or block or call start or end
# - don't consume
|
- (\\\n) # an escaped newline - throw away
+ (\\\r?\n) # an escaped newline - throw away
|
\Z # end of string
)""", re.X | re.S)
@@ -247,7 +247,7 @@ class Lexer(object):
return False
def match_control_line(self):
- match = self.match(r"(?<=^)[\t ]*([%#])[\t ]*([^\n]*)(?:\n|\Z)", re.M)
+ match = self.match(r"(?<=^)[\t ]*([%#])[\t ]*([^\r\n]*)(?:\r?\n|\Z)", re.M)
if match:
operator = match.group(1)
text = match.group(2)