Source code for wikitextparser._wikilink

"""Define the WikiLink class."""


from typing import List, Optional, Tuple

from regex import DOTALL

from ._wikitext import SubWikiText, rc

FULLMATCH = rc(
    rb'[\[\2]\0*+[\[\2]'
    rb'('  # 1: target
    rb'([^|#\]\3]*+)'  # 2: title
    rb'(?>#([^|\]\3]*+))?'  # 3: fragment
    rb')'
    rb'(?:\|(.*))?'  # 4: text
    rb'[\]\3]\0*+[\]\3]',
    DOTALL,
).fullmatch