'Process a chunk of markdown-formatted text and attach the parse to
an ElementTree node.
Process a section of a source document, looking for high
level structural elements like lists, block quotes, code
segments, html blocks, etc.  Some those then get stripped
of their high level markup (e.g. get unindented) and the
lower-level markup is processed recursively.
Keyword arguments:
* parent_elem: The ElementTree element to which the content will be
added.
* lines: a list of lines
* inList: a level
Returns: None'

def parseChunk(self, parent_elem, lines, inList=0, looseList=0):

    while lines:
        if (not lines[0]):
            lines = lines[1:]
            continue
        processFn = {'ul': self.__processUList, 'ol': self.__processOList, 'quoted': self.__processQuote, 'tabbed': self.__processCodeBlock}
        for regexp in ['ul', 'ol', 'quoted', 'tabbed']:
            m = CORE_RE[regexp].match(lines[0])
            if m:
                processFn[regexp](parent_elem, lines, inList)
                return
        if inList:
            (start, lines) = self.__linesUntil(lines, (lambda line: (CORE_RE['ul'].match(line) or CORE_RE['ol'].match(line) or (not line.strip()))))
            self.parseChunk(parent_elem, start, (inList - 1), looseList=looseList)
            inList = (inList - 1)
        else:
            test = (lambda line: ((not line.strip()) or (line[0] == '>')))
            (paragraph, lines) = self.__linesUntil(lines, test)
            if (len(paragraph) and paragraph[0].startswith('#')):
                self.__processHeader(parent_elem, paragraph)
            elif (len(paragraph) and CORE_RE['isline3'].match(paragraph[0])):
                self.__processHR(parent_elem)
                lines = (paragraph[1:] + lines)
            elif paragraph:
                self.__processParagraph(parent_elem, paragraph, inList, looseList)
        if (lines and (not lines[0].strip())):
            lines = lines[1:]
