

def run(self, parent, blocks):
    block = blocks.pop(0)
    m = self.RE.search(block)
    if m:
        before = block[:m.start()]
        after = block[m.end():]
        if before:
            self.parser.parseBlocks(parent, [before])
        h = util.etree.SubElement(parent, ('h%d' % len(m.group('level'))))
        h.text = m.group('header').strip()
        if after:
            blocks.insert(0, after)
    else:
        logger.warn(("We've got a problem header: %r" % block))

dataset/ETHPy150Open darcyliu/storyboard/markdown/blockprocessors.py HashHeaderProcessor.run/original