Add named capture groups
This commit is contained in:
parent
24a9683608
commit
c03ebbf853
@ -17,10 +17,10 @@ with open("./db_explorer/en.json") as f:
|
|||||||
|
|
||||||
@app.template_filter('filter_vtt')
|
@app.template_filter('filter_vtt')
|
||||||
def filter_vtt(text):
|
def filter_vtt(text):
|
||||||
compendium_re = re.compile(r"@Compendium\[([^\]]+)\]\{([^\}]+)\}")
|
compendium_re = re.compile(r"@Compendium\[(?P<ref>[^\]]+)\]\{(?P<value>[^\}]+)\}")
|
||||||
def compendium_return(m):
|
def compendium_return(m):
|
||||||
# TODO: Actually add links
|
# TODO: Actually add links
|
||||||
return f"<a>{m.group(2)}</a>"
|
return f"<a>{m.group('value')}</a>"
|
||||||
macro_re = re.compile(r"\[\[\/\S*?r(?:oll)?\s(?:(?P<sdice>[^\{\] ]+)[^\{\]]*|(?:\{(?P<ldice>[^\}]+)\}\[[^\]]+\])?)\]\](?:\{(?P<alt>[^\}]+)\})?")
|
macro_re = re.compile(r"\[\[\/\S*?r(?:oll)?\s(?:(?P<sdice>[^\{\] ]+)[^\{\]]*|(?:\{(?P<ldice>[^\}]+)\}\[[^\]]+\])?)\]\](?:\{(?P<alt>[^\}]+)\})?")
|
||||||
def macro_return(m):
|
def macro_return(m):
|
||||||
if m.group('alt') is not None:
|
if m.group('alt') is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user