third_party/markdown/treeprocessors.py
def __applyPattern(self, pattern, data, patternIndex, startIndex=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.

        """
        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):
                # We need to process current node too
                for child in [node] + list(node):
                    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.

        
Check if the line fits the pattern, create the necessary
elements, add it to stashed_nodes.

Keyword arguments.

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

String with placeholders instead of ElementTree elements.
Check if the line fits the pattern create the necessary elements add it to stashed_nodes . Keyword arguments . the text to be processed pattern : the pattern to be checked patternIndex : index of current pattern startIndex : string index from which we start searching String with placeholders instead of ElementTree elements .
def __applyPattern(self, pattern, data, patternIndex, startIndex=0):
        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] + list(node):
                    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
def __applyPattern ( self , pattern , data , patternIndex , startIndex = 0 ) : 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 ] + list ( node ) : 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.
Check if the line fits the pattern create the necessary elements add it to stashed_nodes .
"""
        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.

        """ # We need to process current node too
self
pattern
data
patternIndex
startIndex