parameters: (self, tree, ancestors=None)
return_statement: return tree
docstring: 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.
          * ancestors: List of parent tag names that preceed the tree node (if needed).
  
          Returns: ElementTree object with applied inline patterns.
docstring_summary: Apply inline patterns to a parsed Markdown tree.
docstring_tokens: Apply inline patterns to a parsed Markdown tree .
function: def run(self, tree, ancestors=None):
          """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.
          * ancestors: List of parent tag names that preceed the tree node (if needed).
  
          Returns: ElementTree object with applied inline patterns.
  
          """
          self.stashed_nodes = {}
  
          # Ensure a valid parent list, but copy passed in lists
          # to ensure we don't have the user accidentally change it on us.
          tree_parents = [] if ancestors is None else ancestors[:]
  
          self.parent_map = dict((c, p) for p in tree.iter() for c in p)
          stack = [(tree, tree_parents)]
  
          while stack:
              currElement, parents = stack.pop()
  
              self.ancestors = parents
              self.__build_ancestors(currElement, self.ancestors)
  
              insertQueue = []
              for child in currElement:
                  if child.text and not isinstance(
                      child.text, util.AtomicString
                  ):
                      self.ancestors.append(child.tag.lower())
                      text = child.text
                      child.text = None
                      lst = self.__processPlaceholders(
                          self.__handleInline(text), child
                      )
                      for l in lst:
                          self.parent_map[l[0]] = child
                      stack += lst
                      insertQueue.append((child, lst))
                      self.ancestors.pop()
                  if child.tail:
                      tail = self.__handleInline(child.tail)
                      dumby = util.etree.Element('d')
                      child.tail = None
                      tailResult = self.__processPlaceholders(tail, dumby, False)
                      if dumby.tail:
                          child.tail = dumby.tail
                      pos = list(currElement).index(child) + 1
                      tailResult.reverse()
                      for newChild in tailResult:
                          self.parent_map[newChild[0]] = currElement
                          currElement.insert(pos, newChild[0])
                  if len(child):
                      self.parent_map[child] = currElement
                      stack.append((child, self.ancestors[:]))
  
              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 obj in lst:
                      newChild = obj[0]
                      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
function_tokens: def run ( self , tree , ancestors = None ) : self . stashed_nodes = { } # Ensure a valid parent list, but copy passed in lists # to ensure we don't have the user accidentally change it on us. tree_parents = [ ] if ancestors is None else ancestors [ : ] self . parent_map = dict ( ( c , p ) for p in tree . iter ( ) for c in p ) stack = [ ( tree , tree_parents ) ] while stack : currElement , parents = stack . pop ( ) self . ancestors = parents self . __build_ancestors ( currElement , self . ancestors ) insertQueue = [ ] for child in currElement : if child . text and not isinstance ( child . text , util . AtomicString ) : self . ancestors . append ( child . tag . lower ( ) ) text = child . text child . text = None lst = self . __processPlaceholders ( self . __handleInline ( text ) , child ) for l in lst : self . parent_map [ l [ 0 ] ] = child stack += lst insertQueue . append ( ( child , lst ) ) self . ancestors . pop ( ) if child . tail : tail = self . __handleInline ( child . tail ) dumby = util . etree . Element ( 'd' ) child . tail = None tailResult = self . __processPlaceholders ( tail , dumby , False ) if dumby . tail : child . tail = dumby . tail pos = list ( currElement ) . index ( child ) + 1 tailResult . reverse ( ) for newChild in tailResult : self . parent_map [ newChild [ 0 ] ] = currElement currElement . insert ( pos , newChild [ 0 ] ) if len ( child ) : self . parent_map [ child ] = currElement stack . append ( ( child , self . ancestors [ : ] ) ) 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 obj in lst : newChild = obj [ 0 ] 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