aboutsummaryrefslogtreecommitdiffstats
path: root/mako/ext/pygmentplugin.py
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/ext/pygmentplugin.py
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/ext/pygmentplugin.py')
-rw-r--r--mako/ext/pygmentplugin.py4
1 files changed, 2 insertions, 2 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