def run(self, tree):
    'Apply inline patterns to a parsed Markdown tree.\n\n        Iterate over ElementTree, find elements with inline tag, apply inline\n        patterns and append newly created Elements to tree.  If you don\'t\n        want to process your data with inline paterns, instead of normal string,\n        use subclass AtomicString:\n\n            node.text = markdown.AtomicString("This will not be processed.")\n\n        Arguments:\n\n        * tree: ElementTree object, representing Markdown tree.\n\n        Returns: ElementTree object with applied inline patterns.\n\n        '
    self.stashed_nodes = {}
    stack = [tree]
    while stack:
        currElement = stack.pop()
        insertQueue = []
        for child in currElement.getchildren():
            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 = (currElement.getchildren().index(child) + 1)
                tailResult.reverse()
                for newChild in tailResult:
                    currElement.insert(pos, newChild)
            if child.getchildren():
                stack.append(child)
        for (element, lst) in insertQueue:
            if self.markdown.enable_attributes:
                if element.text:
                    element.text = inlinepatterns.handleAttributes(element.text, element)
            i = 0
            for newChild in lst:
                if self.markdown.enable_attributes:
                    if newChild.tail:
                        newChild.tail = inlinepatterns.handleAttributes(newChild.tail, element)
                    if 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.
def run(self, tree):
    'Apply inline patterns to a parsed Markdown tree.\n\n        Iterate over ElementTree, find elements with inline tag, apply inline\n        patterns and append newly created Elements to tree.  If you don\'t\n        want to process your data with inline paterns, instead of normal string,\n        use subclass AtomicString:\n\n            node.text = markdown.AtomicString("This will not be processed.")\n\n        Arguments:\n\n        * tree: ElementTree object, representing Markdown tree.\n\n        Returns: ElementTree object with applied inline patterns.\n\n        '
    self.stashed_nodes = {}
    stack = [tree]
    while stack:
        currElement = stack.pop()
        insertQueue = []
        for child in currElement.getchildren():
            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 = (currElement.getchildren().index(child) + 1)
                tailResult.reverse()
                for newChild in tailResult:
                    currElement.insert(pos, newChild)
            if child.getchildren():
                stack.append(child)
        for (element, lst) in insertQueue:
            if self.markdown.enable_attributes:
                if element.text:
                    element.text = inlinepatterns.handleAttributes(element.text, element)
            i = 0
            for newChild in lst:
                if self.markdown.enable_attributes:
                    if newChild.tail:
                        newChild.tail = inlinepatterns.handleAttributes(newChild.tail, element)
                    if newChild.text:
                        newChild.text = inlinepatterns.handleAttributes(newChild.text, newChild)
                element.insert(i, newChild)
                i += 1
    return tree