third_party/markdown/treeprocessors.py
def run(self, tree):
        """Apply inline patterns to a parsed Markdown tree.

        Iterate over ElementTree, find elements with inline tag, apply inline
        patterns and append newly created Elements to tree.  If you don't
        want to process your data with inline paterns, instead of normal string,
        use subclass AtomicString:

            node.text = markdown.AtomicString("This will not be processed.")

        Arguments:

        * tree: ElementTree object, representing Markdown tree.

        Returns: ElementTree object with applied inline patterns.

        """
        self.stashed_nodes = {}

        stack = [tree]

        while stack:
            currElement = stack.pop()
            insertQueue = []
            for child in currElement:
                if child.text and not isinstance(child.text, util.AtomicString):
                    text = child.text
                    child.text = None
                    lst = self.__processPlaceholders(self.__handleInline(
                                                    text), child)
                    stack += lst
                    insertQueue.append((child, lst))
                if child.tail:
                    tail = self.__handleInline(child.tail)
                    dumby = util.etree.Element('d')
                    tailResult = self.__processPlaceholders(tail, dumby)
                    if dumby.text:
                        child.tail = dumby.text
                    else:
                        child.tail = None
                    pos = list(currElement).index(child) + 1
                    tailResult.reverse()
                    for newChild in tailResult:
                        currElement.insert(pos, newChild)
                if list(child):
                    stack.append(child)

            for element, lst in insertQueue:
                if self.markdown.enable_attributes:
                    if element.text and isString(element.text):
                        element.text = \
                            inlinepatterns.handleAttributes(element.text, 
                                                                    element)
                i = 0
                for newChild in lst:
                    if self.markdown.enable_attributes:
                        # Processing attributes
                        if newChild.tail and isString(newChild.tail):
                            newChild.tail = \
                                inlinepatterns.handleAttributes(newChild.tail,
                                                                    element)
                        if newChild.text and isString(newChild.text):
                            newChild.text = \
                                inlinepatterns.handleAttributes(newChild.text,
                                                                    newChild)
                    element.insert(i, newChild)
                    i += 1
        return tree
Apply inline patterns to a parsed Markdown tree.

        Iterate over ElementTree, find elements with inline tag, apply inline
        patterns and append newly created Elements to tree.  If you don't
        want to process your data with inline paterns, instead of normal string,
        use subclass AtomicString:

            node.text = markdown.AtomicString("This will not be processed.")

        Arguments:

        * tree: ElementTree object, representing Markdown tree.

        Returns: ElementTree object with applied inline patterns.

        
Apply inline patterns to a parsed Markdown tree.
Iterate over ElementTree, find elements with inline tag, apply inline
patterns and append newly created Elements to tree.  If you don't
want to process your data with inline paterns, instead of normal string,
use subclass AtomicString.





ElementTree object, representing Markdown tree.

ElementTree object with applied inline patterns.
Apply inline patterns to a parsed Markdown tree . Iterate over ElementTree find elements with inline tag apply inline patterns and append newly created Elements to tree . If you don ' t want to process your data with inline paterns instead of normal string use subclass AtomicString . ElementTree object representing Markdown tree . ElementTree object with applied inline patterns .
def run(self, tree):
        self.stashed_nodes = {}
        stack = [tree]
        while stack:
            currElement = stack.pop()
            insertQueue = []
            for child in currElement:
                if child.text and not isinstance(child.text, util.AtomicString):
                    text = child.text
                    child.text = None
                    lst = self.__processPlaceholders(self.__handleInline(
                                                    text), child)
                    stack += lst
                    insertQueue.append((child, lst))
                if child.tail:
                    tail = self.__handleInline(child.tail)
                    dumby = util.etree.Element('d')
                    tailResult = self.__processPlaceholders(tail, dumby)
                    if dumby.text:
                        child.tail = dumby.text
                    else:
                        child.tail = None
                    pos = list(currElement).index(child) + 1
                    tailResult.reverse()
                    for newChild in tailResult:
                        currElement.insert(pos, newChild)
                if list(child):
                    stack.append(child)
            for element, lst in insertQueue:
                if self.markdown.enable_attributes:
                    if element.text and isString(element.text):
                        element.text = \
                            inlinepatterns.handleAttributes(element.text, 
                                                                    element)
                i = 0
                for newChild in lst:
                    if self.markdown.enable_attributes:
                        if newChild.tail and isString(newChild.tail):
                            newChild.tail = \
                                inlinepatterns.handleAttributes(newChild.tail,
                                                                    element)
                        if newChild.text and isString(newChild.text):
                            newChild.text = \
                                inlinepatterns.handleAttributes(newChild.text,
                                                                    newChild)
                    element.insert(i, newChild)
                    i += 1
        return tree
def run ( self , tree ) : self . stashed_nodes = { } stack = [ tree ] while stack : currElement = stack . pop ( ) insertQueue = [ ] for child in currElement : if child . text and not isinstance ( child . text , util . AtomicString ) : text = child . text child . text = None lst = self . __processPlaceholders ( self . __handleInline ( text ) , child ) stack += lst insertQueue . append ( ( child , lst ) ) if child . tail : tail = self . __handleInline ( child . tail ) dumby = util . etree . Element ( 'd' ) tailResult = self . __processPlaceholders ( tail , dumby ) if dumby . text : child . tail = dumby . text else : child . tail = None pos = list ( currElement ) . index ( child ) + 1 tailResult . reverse ( ) for newChild in tailResult : currElement . insert ( pos , newChild ) if list ( child ) : stack . append ( child ) for element , lst in insertQueue : if self . markdown . enable_attributes : if element . text and isString ( element . text ) : element . text = inlinepatterns . handleAttributes ( element . text , element ) i = 0 for newChild in lst : if self . markdown . enable_attributes : if newChild . tail and isString ( newChild . tail ) : newChild . tail = inlinepatterns . handleAttributes ( newChild . tail , element ) if newChild . text and isString ( newChild . text ) : newChild . text = inlinepatterns . handleAttributes ( newChild . text , newChild ) element . insert ( i , newChild ) i += 1 return tree
Apply inline patterns to a parsed Markdown tree.
Apply inline patterns to a parsed Markdown tree .
"""Apply inline patterns to a parsed Markdown tree.

        Iterate over ElementTree, find elements with inline tag, apply inline
        patterns and append newly created Elements to tree.  If you don't
        want to process your data with inline paterns, instead of normal string,
        use subclass AtomicString:

            node.text = markdown.AtomicString("This will not be processed.")

        Arguments:

        * tree: ElementTree object, representing Markdown tree.

        Returns: ElementTree object with applied inline patterns.

        """ # Processing attributes
self
tree