mirror of
https://github.com/affaan-m/ECC.git
synced 2026-10-26 18:35:05 +00:00
fix(governance): validate shortcut references before colons
This commit is contained in:
1 parent
a28d60c7bc
commit
188bdf2d6a
3 files changed
+27
-4
No files matched your search
@@ -139,14 +139,20 @@ def normalize_reference_label(label: str) -> str:
|
||||
|
||||
|
||||
def reference_link_targets(text: str) -> list[str]:
|
||||
definition_matches = list(REFERENCE_DEFINITION_RE.finditer(text))
|
||||
definitions = {
|
||||
normalize_reference_label(match.group("label")): match.group("target")
|
||||
for match in REFERENCE_DEFINITION_RE.finditer(text)
|
||||
for match in definition_matches
|
||||
}
|
||||
targets: list[str] = []
|
||||
for match in REFERENCE_USAGE_RE.finditer(text):
|
||||
if any(
|
||||
definition.start() <= match.start() < definition.end()
|
||||
for definition in definition_matches
|
||||
):
|
||||
continue
|
||||
following = text[match.end() : match.end() + 1]
|
||||
if following in {"(", ":"}:
|
||||
if following == "(":
|
||||
continue
|
||||
label = match.group("label")
|
||||
key = normalize_reference_label(label or match.group("text"))
|
||||
|
||||
Reference in new issue
Block a user