Allow multiple links in one line

This commit is contained in:
Tanner Collin 2024-11-11 19:28:15 +02:00
parent 41dd1d6491
commit 8e7f80fa2f

View File

@ -12,13 +12,15 @@ from markdown import Markdown
ARTICLE_PATHS = {}
FILE_PATHS = {}
link = r'\[\[\s*(?P<filename>[^|\]]+)(\|\s*(?P<linkname>.+))?\]\]'
#link = r'\[\[\s*(?P<filename>[^|\]]+)(\|\s*(?P<linkname>.+))?\]\]' # greedy, broken multiple same line
link = r'\[\[\s*(?P<filename>[^|\]]+?)(\|\s*(?P<linkname>.+?))?\]\]' # non-greedy
file_re = re.compile(r'!' + link)
link_re = re.compile(link)
"""
# Test cases
be sure to check the [[The Useless Room|electronics room]] and [[Incubation Room]]
[[my link]]
[[ my work ]]
[[ my work | is finished ]]