def __applyPattern(self, pattern, data, patternIndex, startIndex=0):
    '\n        Check if the line fits the pattern, create the necessary\n        elements, add it to stashed_nodes.\n\n        Keyword arguments:\n\n        * data: the text to be processed\n        * pattern: the pattern to be checked\n        * patternIndex: index of current pattern\n        * startIndex: string index, from which we start searching\n\n        Returns: String with placeholders instead of ElementTree elements.\n\n        '
    match = pattern.getCompiledRegExp().match(data[startIndex:])
    leftData = data[:startIndex]
    if (not match):
        return (data, False, 0)
    node = pattern.handleMatch(match)
    if (node is None):
        return (data, True, (len(leftData) + match.span(len(match.groups()))[0]))
    if (not isString(node)):
        if (not isinstance(node.text, util.AtomicString)):
            for child in ([node] + node.getchildren()):
                if (not isString(node)):
                    if child.text:
                        child.text = self.__handleInline(child.text, (patternIndex + 1))
                    if child.tail:
                        child.tail = self.__handleInline(child.tail, patternIndex)
    placeholder = self.__stashNode(node, pattern.type())
    return (('%s%s%s%s' % (leftData, match.group(1), placeholder, match.groups()[(- 1)])), True, 0)
Check if the line fits the pattern, create the necessary
elements, add it to stashed_nodes.

Keyword arguments:

* data: the text to be processed
* pattern: the pattern to be checked
* patternIndex: index of current pattern
* startIndex: string index, from which we start searching

Returns: String with placeholders instead of ElementTree elements.
def __applyPattern(self, pattern, data, patternIndex, startIndex=0):
    '\n        Check if the line fits the pattern, create the necessary\n        elements, add it to stashed_nodes.\n\n        Keyword arguments:\n\n        * data: the text to be processed\n        * pattern: the pattern to be checked\n        * patternIndex: index of current pattern\n        * startIndex: string index, from which we start searching\n\n        Returns: String with placeholders instead of ElementTree elements.\n\n        '
    match = pattern.getCompiledRegExp().match(data[startIndex:])
    leftData = data[:startIndex]
    if (not match):
        return (data, False, 0)
    node = pattern.handleMatch(match)
    if (node is None):
        return (data, True, (len(leftData) + match.span(len(match.groups()))[0]))
    if (not isString(node)):
        if (not isinstance(node.text, util.AtomicString)):
            for child in ([node] + node.getchildren()):
                if (not isString(node)):
                    if child.text:
                        child.text = self.__handleInline(child.text, (patternIndex + 1))
                    if child.tail:
                        child.tail = self.__handleInline(child.tail, patternIndex)
    placeholder = self.__stashNode(node, pattern.type())
    return (('%s%s%s%s' % (leftData, match.group(1), placeholder, match.groups()[(- 1)])), True, 0)