aboutsummaryrefslogtreecommitdiffstats
path: root/mako
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-03-05 01:55:41 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-03-05 01:55:41 +0000
commit2bc0ea9cebeda00b0b23d633ee87cbc819829fd8 (patch)
treedc137e7210b619672b3c977ad1d323ccc7776c30 /mako
parent524bdae950f36d540b18ee5ad7910fadf45e30d1 (diff)
downloadexternal_python_mako-2bc0ea9cebeda00b0b23d633ee87cbc819829fd8.tar.gz
external_python_mako-2bc0ea9cebeda00b0b23d633ee87cbc819829fd8.tar.bz2
external_python_mako-2bc0ea9cebeda00b0b23d633ee87cbc819829fd8.zip
- A percent sign can be emitted as the first
non-whitespace character on a line by escaping it as in "%%". [ticket:112]
Diffstat (limited to 'mako')
-rw-r--r--mako/ext/pygmentplugin.py4
-rw-r--r--mako/lexer.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/mako/ext/pygmentplugin.py b/mako/ext/pygmentplugin.py
index 09ffe12..2e7ff0d 100644
--- a/mako/ext/pygmentplugin.py
+++ b/mako/ext/pygmentplugin.py
@@ -22,7 +22,7 @@ class MakoLexer(RegexLexer):
'root': [
(r'(\s*)(\%)(\s*end(?:\w+))(\n|\Z)',
bygroups(Text, Comment.Preproc, Keyword, Other)),
- (r'(\s*)(\%)([^\n]*)(\n|\Z)',
+ (r'(\s*)(\%(?!%))([^\n]*)(\n|\Z)',
bygroups(Text, Comment.Preproc, using(PythonLexer), Other)),
(r'(\s*)(##[^\n]*)(\n|\Z)',
bygroups(Text, Comment.Preproc, Other)),
@@ -36,7 +36,7 @@ class MakoLexer(RegexLexer):
(r'''(?sx)
(.+?) # anything, followed by:
(?:
- (?<=\n)(?=%|\#\#) | # an eval or comment line
+ (?<=\n)(?=%(?!%)|\#\#) | # an eval or comment line
(?=\#\*) | # multiline comment
(?=</?%) | # a python block
# call start or end
diff --git a/mako/lexer.py b/mako/lexer.py
index 5e4a3bc..34fe80b 100644
--- a/mako/lexer.py
+++ b/mako/lexer.py
@@ -371,7 +371,7 @@ class Lexer(object):
return False
def match_control_line(self):
- match = self.match(r"(?<=^)[\t ]*(%|##)[\t ]*((?:(?:\\r?\n)|[^\r\n])*)(?:\r?\n|\Z)", re.M)
+ match = self.match(r"(?<=^)[\t ]*(%(?!%)|##)[\t ]*((?:(?:\\r?\n)|[^\r\n])*)(?:\r?\n|\Z)", re.M)
if match:
operator = match.group(1)
text = match.group(2)