(self, data, parent)
return result
Process string with placeholders and generate ElementTree tree.

        Keyword arguments:

        * data: string with placeholders instead of ElementTree elements.
        * parent: Element, which contains processing inline data

        Returns: list with ElementTree elements with applied inline patterns.
Process string with placeholders and generate ElementTree tree.
Process string with placeholders and generate ElementTree tree .
def __processPlaceholders(self, data, parent):
        """
        Process string with placeholders and generate ElementTree tree.

        Keyword arguments:

        * data: string with placeholders instead of ElementTree elements.
        * parent: Element, which contains processing inline data

        Returns: list with ElementTree elements with applied inline patterns.
        
        """
        def linkText(text):
            if text:
                if result:
                    if result[-1].tail:
                        result[-1].tail += text
                    else:
                        result[-1].tail = text
                else:
                    if parent.text:
                        parent.text += text
                    else:
                        parent.text = text
        result = []
        strartIndex = 0
        while data:
            index = data.find(self.__placeholder_prefix, strartIndex)
            if index != -1:
                id, phEndIndex = self.__findPlaceholder(data, index)

                if id in self.stashed_nodes:
                    node = self.stashed_nodes.get(id)

                    if index > 0:
                        text = data[strartIndex:index]
                        linkText(text)

                    if not isString(node): # it's Element
                        for child in [node] + node.getchildren():
                            if child.tail:
                                if child.tail.strip():
                                    self.__processElementText(node, child,False)
                            if child.text:
                                if child.text.strip():
                                    self.__processElementText(child, child)
                    else: # it's just a string
                        linkText(node)
                        strartIndex = phEndIndex
                        continue

                    strartIndex = phEndIndex
                    result.append(node)

                else: # wrong placeholder
                    end = index + len(self.__placeholder_prefix)
                    linkText(data[strartIndex:end])
                    strartIndex = end
            else:
                text = data[strartIndex:]
                if isinstance(data, util.AtomicString):
                    # We don't want to loose the AtomicString
                    text = util.AtomicString(text)
                linkText(text)
                data = ""

        return result
def __processPlaceholders ( self , data , parent ) : def linkText ( text ) : if text : if result : if result [ - 1 ] . tail : result [ - 1 ] . tail += text else : result [ - 1 ] . tail = text else : if parent . text : parent . text += text else : parent . text = text result = [ ] strartIndex = 0 while data : index = data . find ( self . __placeholder_prefix , strartIndex ) if index != - 1 : id , phEndIndex = self . __findPlaceholder ( data , index ) if id in self . stashed_nodes : node = self . stashed_nodes . get ( id ) if index > 0 : text = data [ strartIndex : index ] linkText ( text ) if not isString ( node ) : # it's Element for child in [ node ] + node . getchildren ( ) : if child . tail : if child . tail . strip ( ) : self . __processElementText ( node , child , False ) if child . text : if child . text . strip ( ) : self . __processElementText ( child , child ) else : # it's just a string linkText ( node ) strartIndex = phEndIndex continue strartIndex = phEndIndex result . append ( node ) else : # wrong placeholder end = index + len ( self . __placeholder_prefix ) linkText ( data [ strartIndex : end ] ) strartIndex = end else : text = data [ strartIndex : ] if isinstance ( data , util . AtomicString ) : # We don't want to loose the AtomicString text = util . AtomicString ( text ) linkText ( text ) data = "" return result