From 5255296dba97c7a60bff2411b216335930a41abd Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Wed, 11 Sep 2019 11:30:27 +1000 Subject: [PATCH] Correct table header parsing --- legalmd/legal_token.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/legalmd/legal_token.py b/legalmd/legal_token.py index ce0be4c..90745c2 100644 --- a/legalmd/legal_token.py +++ b/legalmd/legal_token.py @@ -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