Correct table header parsing
This commit is contained in:
parent
245a5ee46e
commit
5255296dba
@ -193,7 +193,7 @@ class TableRow(mistletoe.block_token.BlockToken):
|
||||
self.label = self.children[0].label
|
||||
|
||||
class TableCell(mistletoe.block_token.BlockToken):
|
||||
pattern1 = re.compile(r'\s*([0-9A-Za-z]+\s+)?(\[[0-9]+\])?(.*)')
|
||||
pattern1 = re.compile(r'\s*(?:([0-9A-Za-z]+)(?:\[([0-9]+)\])?\s+)?(.*)')
|
||||
|
||||
def __init__(self, inner, row, colnum, align=None):
|
||||
self.row = row
|
||||
@ -204,7 +204,7 @@ class TableCell(mistletoe.block_token.BlockToken):
|
||||
label, weight, content = self.pattern1.match(inner).group(1, 2, 3)
|
||||
|
||||
self.label = label.strip() if label else None
|
||||
self.weight = int(weight[1:-1]) if weight else 1
|
||||
self.weight = int(weight) if weight else 1
|
||||
self.children = mistletoe.span_token.tokenize_inner(content)
|
||||
else:
|
||||
self.label = None
|
||||
|
Loading…
Reference in New Issue
Block a user