From 8b6717aad949ca17485c8e63a2f3a6df432d2e4f Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Sun, 22 Sep 2019 03:46:20 +1000 Subject: [PATCH] Minor tweaks to token definitions Allow numbered heading to contain en-dash Allow cross reference type to contain periods --- 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 52cf120..4dc941c 100644 --- a/legalmd/legal_token.py +++ b/legalmd/legal_token.py @@ -22,7 +22,7 @@ import mistletoe mistletoe.block_token.remove_token(mistletoe.block_token.BlockCode) class NumberedHeading(mistletoe.block_token.BlockToken): - pattern = re.compile(r'(#{1,6})\s*([0-9A-Z]+|xx)\s+(.+)') + pattern = re.compile(r'(#{1,6})\s*([0-9A-Z–]+|xx)\s+(.+)') def __init__(self, match): self.level, self.label, content = match @@ -244,7 +244,7 @@ mistletoe.block_token.remove_token(mistletoe.block_token.Table) mistletoe.block_token.add_token(Table) class CrossReference(mistletoe.span_token.SpanToken): - pattern = re.compile(r'`(?:([A-Za-z]+?)\s+)?([0-9A-Za-z\(\)]+?)`_') + pattern = re.compile(r'`(?:([A-Za-z.]+?)\s+)?([0-9A-Za-z\(\)]+?)`_') pattern_parts = re.compile(r'^[0-9A-Za-z]+|\([0-9A-Za-z]+\)') def __init__(self, match):