# Buggy code
def build_block_parser(md, **kwargs):
    """Build the default block parser used by Markdown."""
    parser = BlockParser(md)
    parser.blockprocessors.register(EmptyBlockProcessor(parser), "empty", 100)
    parser.blockprocessors.register(ListIndentProcessor(parser), "indent", 90)
    parser.blockprocessors.register(CodeBlockProcessor(parser), "code", 80)
    parser.blockprocessors.register(HashHeaderProcessor(parser), "hashheader", 70)
    parser.blockprocessors.register(SetextHeaderProcessor(parser), "setextheader", 60)
    parser.blockprocessors.register(HRProcessor(parser), "hr", 50)
    parser.blockprocessors.register(OListProcessor(parser), "olist", 40)
    parser.blockprocessors.register(UListProcessor(parser), "ulist", 30)
    parser.blockprocessors.register(BlockQuoteProcessor(parser), "quote", 20)
    parser.blockprocessors.register(ParagraphProcessor(parser), "paragraph", 10)
    return parser


# Traceback (IndexError)
Traceback (most recent call last):
File "/home/ikus060/workspace/PDSL/markdown.git/markdown/test_tools.py", line 117, in test
output = markdown(input, **kwargs)
File "/home/ikus060/workspace/PDSL/markdown.git/markdown/core.py", line 391, in markdown
return md.convert(text)
File "/home/ikus060/workspace/PDSL/markdown.git/markdown/core.py", line 268, in convert
root = self.parser.parseDocument(self.lines).getroot()
File "/home/ikus060/workspace/PDSL/markdown.git/markdown/blockparser.py", line 92, in parseDocument
self.parseChunk(self.root, '\n'.join(lines))
File "/home/ikus060/workspace/PDSL/markdown.git/markdown/blockparser.py", line 107, in parseChunk
self.parseBlocks(parent, text.split('\n\n'))
File "/home/ikus060/workspace/PDSL/markdown.git/markdown/blockparser.py", line 125, in parseBlocks
if processor.run(parent, blocks) is not False:
File "/home/ikus060/workspace/PDSL/markdown.git/markdown/extensions/extra.py", line 127, in run
block = self._process_nests(element, block)
File "/home/ikus060/workspace/PDSL/markdown.git/markdown/extensions/extra.py", line 95, in _process_nests
block[nest_index[-1][1]:], True)                      # nest
File "/home/ikus060/workspace/PDSL/markdown.git/markdown/extensions/extra.py", line 101, in run
tag = self._tag_data[self.parser.blockprocessors.tag_counter]
IndexError: list index out of range

# Fixed code
def build_block_parser(md, **kwargs):
    """Build the default block parser used by Markdown."""
    parser = BlockParser(md)
    parser.blockprocessors.register(EmptyBlockProcessor(parser), "empty", 100)
    parser.blockprocessors.register(ListIndentProcessor(parser), "indent", 90)
    parser.blockprocessors.register(CodeBlockProcessor(parser), "code", 80)
    parser.blockprocessors.register(HashHeaderProcessor(parser), "hashheader", 70)
    parser.blockprocessors.register(SetextHeaderProcessor(parser), "setextheader", 60)
    parser.blockprocessors.register(HRProcessor(parser), "hr", 50)
    parser.blockprocessors.register(OListProcessor(parser), "olist", 40)
    parser.blockprocessors.register(UListProcessor(parser), "ulist", 30)
    parser.blockprocessors.register(BlockQuoteProcessor(parser), "quote", 20)
    parser.blockprocessors.register(ReferenceProcessor(parser), "reference", 15)
    parser.blockprocessors.register(ParagraphProcessor(parser), "paragraph", 10)
    return parser