Added support for multiple WML child nodes of the same name...

...to the simple parser.
This commit is contained in:
Gregory Shikhman 2009-08-09 20:16:51 +00:00
parent 80ca33ffcc
commit fccd118c38

View File

@ -103,7 +103,12 @@ def build_tree(lines):
if tag.match(l) and not endtag.match(l):
#start of a new wml tag
tagname = l[1:len(l)-1]
vars[tagname] = build_tree(lines[i+1:])
if not vars.has_key(tagname):
vars[tagname] = build_tree(lines[i+1:])
else:
if not isinstance(vars[tagname],types.ListType):
vars[tagname] = [ vars[tagname] ]
vars[tagname].append(build_tree(lines[i+1:]))
#go past the end of the tag we just processed
while lines[i].strip() != ("[/%s]" % (tagname)):
i += 1