Fix xref links

This commit is contained in:
Adrian Rumpold
2025-04-29 09:41:17 +02:00
parent 04f46e3893
commit 860c67b00b
2 changed files with 10 additions and 7 deletions

View File

@@ -74,9 +74,7 @@ def extract_xrefs(el: lxml.etree.Element, language: Language) -> list[CrossRefer
}
for key, pattern in patterns.items():
matches = re.finditer(pattern, text, flags=re.IGNORECASE)
print(f"Pattern: {pattern}")
for match in matches:
print(f"Match: {match.group(0)}")
crossref_id = (
match.group("art_num") if key == "article" else match.group("annex_num")
)
@@ -158,8 +156,6 @@ class FormexArticleConverter:
if not is_title and not element.getchildren():
# Cross-references should be treated at the deepest level
xrefs = extract_xrefs(element, self.language)
print("Extracted cross-references: ", xrefs)
for xref in xrefs:
# Replace the cross-reference text with a link
result = self._replace_xref(result, xref)