'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 __processPlaceholders(self, data, parent, isText=True):

    def linkText(text):
        if text:
            if result:
                if result[(-1)].tail:
                    result[(-1)].tail += text
                else:
                    result[(-1)].tail = text
            elif (not isText):
                if parent.tail:
                    parent.tail += text
                else:
                    parent.tail = text
            elif 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)):
                    for child in ([node] + list(node)):
                        if child.tail:
                            if child.tail.strip():
                                self.__processElementText(node, child, False)
                        if child.text:
                            if child.text.strip():
                                self.__processElementText(child, child)
                else:
                    linkText(node)
                    strartIndex = phEndIndex
                    continue
                strartIndex = phEndIndex
                result.append(node)
            else:
                end = (index + len(self.__placeholder_prefix))
                linkText(data[strartIndex:end])
                strartIndex = end
        else:
            text = data[strartIndex:]
            if isinstance(data, util.AtomicString):
                text = util.AtomicString(text)
            linkText(text)
            data = u''
    return result
