aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mako/lexer.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-11-19 18:47:45 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-11-19 18:47:45 +0000
commitdf656c2ca7538fa165b8c93349c9fc763d0ea380 (patch)
tree6fa929175f433b2c7450e8962b7a12386b757e3b /lib/mako/lexer.py
parent9a2c39f845c7b3e2a8ad428b381466d20ad0f475 (diff)
downloadexternal_python_mako-df656c2ca7538fa165b8c93349c9fc763d0ea380.tar.gz
external_python_mako-df656c2ca7538fa165b8c93349c9fc763d0ea380.tar.bz2
external_python_mako-df656c2ca7538fa165b8c93349c9fc763d0ea380.zip
nested components, codegen arch, lexer fixes
Diffstat (limited to 'lib/mako/lexer.py')
-rw-r--r--lib/mako/lexer.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/mako/lexer.py b/lib/mako/lexer.py
index 81abdf9..2dfa5d1 100644
--- a/lib/mako/lexer.py
+++ b/lib/mako/lexer.py
@@ -93,7 +93,23 @@ class Lexer(object):
return self.template
def match_tag_start(self):
- match = self.match(r'''\<%(\w+)\s+(.+?["'])?\s*(/)?>''', re.I | re.S )
+ match = self.match(r'''
+ \<% # opening tag
+
+ (\w+) # keyword
+
+ \s+ # some space
+
+ ((?:\w+|=|".*?"|'.*?')*) # attrname, = sign, string expression
+
+ \s* # more whitespace
+
+ (/)?> # closing
+
+ ''',
+
+ re.I | re.S | re.X)
+
if match:
(keyword, attr, isend) = (match.group(1).lower(), match.group(2), match.group(3))
self.keyword = keyword
@@ -102,7 +118,6 @@ class Lexer(object):
for att in re.findall(r"\s*(\w+)\s*=\s*(?:'([^']*)'|\"([^\"]*)\")", attr):
(key, val1, val2) = att
attributes[key] = val1 or val2
-
self.append_node(parsetree.Tag, keyword, attributes)
if isend:
self.tag.pop()