'Parse a table block and build table.'

def run(self, parent, blocks):

    block = blocks.pop(0).split(u'\n')
    header = block[0].strip()
    seperator = block[1].strip()
    rows = ([] if (len(block) < 3) else block[2:])
    border = False
    if header.startswith(u'|'):
        border = True
    align = []
    for c in self._split_row(seperator, border):
        if (c.startswith(u':') and c.endswith(u':')):
            align.append(u'center')
        elif c.startswith(u':'):
            align.append(u'left')
        elif c.endswith(u':'):
            align.append(u'right')
        else:
            align.append(None)
    table = etree.SubElement(parent, u'table')
    thead = etree.SubElement(table, u'thead')
    self._build_row(header, thead, align, border)
    tbody = etree.SubElement(table, u'tbody')
    for row in rows:
        self._build_row(row.strip(), tbody, align, border)
