[px] Added the possibility to have several PX actions in the same XHTML tag. If several PX action are defined, they are evaluated in this order: var, for, if.

This commit is contained in:
Gaetan Delannay 2013-06-25 23:22:33 +02:00
parent 1bc2a2f890
commit 5ece5c9831
6 changed files with 257 additions and 19 deletions

View file

@ -46,7 +46,7 @@ class PxParser(XmlParser):
'''PX parser that is specific for parsing PX data.'''
pxAttributes = ('var', 'for', 'if')
# No-end tags
noEndTags = ('br', 'img')
noEndTags = ('br', 'img', 'link', 'input')
def __init__(self, env, caller=None):
XmlParser.__init__(self, env, caller)
@ -56,13 +56,16 @@ class PxParser(XmlParser):
e = self.env
self.currentElem = elem
# See if we have a PX attribute among p_attrs.
found = False
for name in self.pxAttributes:
if attrs.has_key(name):
# Dump the element in a new sub-buffer
e.addSubBuffer()
# Create the action for this buffer
if not found:
# This is the first PX attr we find.
# Create a sub-buffer with an action.
e.addSubBuffer()
found = True
# Add the action.
e.currentBuffer.createPxAction(elem, name, attrs[name])
break
if e.isActionElem(elem):
# Add a temp element in the buffer (that will be unreferenced
# later). This way, when encountering the corresponding end element,