Minor tweaks to token definitions

Allow numbered heading to contain en-dash
Allow cross reference type to contain periods
This commit is contained in:
RunasSudo 2019-09-22 03:46:20 +10:00
parent 1f53129848
commit 8b6717aad9
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -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):