'Parse a table block and build table.'

def run(self, parent, blocks):

    block = blocks.pop(0).split(u'\n')
    header = block[0].strip()
    rows = ([] if (len(block) < 3) else block[2:])
    align = []
    for c in self.separator:
        c = c.strip()
        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)
    tbody = etree.SubElement(table, u'tbody')
    if (len(rows) == 0):
        self._build_empty_row(tbody, align)
    else:
        for row in rows:
            self._build_row(row.strip(), tbody, align)
