#NEWLINE# def parseChunk( self , parent_elem , lines , inList = 0 , looseList = 0 ) : #NEWLINE# #INDENT# 'Process a chunk of markdown-formatted text and attach the parse to\n        an ElementTree node.\n\n        Process a section of a source document, looking for high\n        level structural elements like lists, block quotes, code\n        segments, html blocks, etc.  Some those then get stripped\n        of their high level markup (e.g. get unindented) and the\n        lower-level markup is processed recursively.\n\n        Keyword arguments:\n\n        * parent_elem: The ElementTree element to which the content will be\n                       added.\n        * lines: a list of lines\n        * inList: a level\n\n        Returns: None\n\n        ' #NEWLINE# while lines : #NEWLINE# #INDENT# if ( not lines [ 0 ] ) : #NEWLINE# #INDENT# lines = lines [ 1 : ] #NEWLINE# continue #NEWLINE# #UNINDENT# processFn = { #NEWLINE# #INDENT# 'ul' : self . __processUList , #NEWLINE# 'ol' : self . __processOList , #NEWLINE# 'quoted' : self . __processQuote , #NEWLINE# 'tabbed' : self . __processCodeBlock , #NEWLINE# #UNINDENT# } #NEWLINE# for regexp in [ 'ul' , 'ol' , 'quoted' , 'tabbed' ] : #NEWLINE# #INDENT# m = CORE_RE [ regexp ] . match ( lines [ 0 ] ) #NEWLINE# if m : #NEWLINE# #INDENT# processFn [ regexp ] ( parent_elem , lines , inList ) #NEWLINE# return #NEWLINE# #UNINDENT# #UNINDENT# if inList : #NEWLINE# #INDENT# ( start , lines ) = self . __linesUntil ( lines , ( lambda line : ( CORE_RE [ 'ul' ] . match ( line ) or CORE_RE [ 'ol' ] . match ( line ) or ( not line . strip ( ) ) ) ) ) #NEWLINE# self . parseChunk ( parent_elem , start , ( inList - 1 ) , looseList = looseList ) #NEWLINE# inList = ( inList - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# test = ( lambda line : ( ( not line . strip ( ) ) or ( line [ 0 ] == '>' ) ) ) #NEWLINE# ( paragraph , lines ) = self . __linesUntil ( lines , test ) #NEWLINE# if ( len ( paragraph ) and paragraph [ 0 ] . startswith ( '#' ) ) : #NEWLINE# #INDENT# self . __processHeader ( parent_elem , paragraph ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( paragraph ) and CORE_RE [ 'isline3' ] . match ( paragraph [ 0 ] ) ) : #NEWLINE# #INDENT# self . __processHR ( parent_elem ) #NEWLINE# lines = ( paragraph [ 1 : ] + lines ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if paragraph : #NEWLINE# #INDENT# self . __processParagraph ( parent_elem , paragraph , inList , looseList ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( lines and ( not lines [ 0 ] . strip ( ) ) ) : #NEWLINE# #INDENT# lines = lines [ 1 : ]