Compare commits

...

2 Commits

Author SHA1 Message Date
Darragh Elliott
75b5c0cde0 fix: actually search files for tags properly
All checks were successful
continuous-integration/drone/pr Build is passing
2025-06-05 20:08:44 +01:00
Darragh Elliott
0beac7a12b fix: update xmllist tag search 2025-06-05 19:28:22 +01:00

View File

@ -45,25 +45,34 @@ def _update_for_base(
logger.debug("Pattern too short, continue!") logger.debug("Pattern too short, continue!")
continue continue
tag = ( tag = (
re.match(r":\[(.*)\]$", line).group().strip() re.search(r":\[(.*)\]", line).group(1).strip()
if re.match(r":\[(.*)\]$", line) if re.search(r":\[(.*)\]", line) is not None
else "" else ""
) )
for line in filter(
lambda line: for xml_file in filter(
lambda xml_file:
# Matches glob pattern # Matches glob pattern
fnmatch.fnmatchcase(str(line), pattern) fnmatch.fnmatchcase(str(xml_file), pattern)
# contains tag if tag in pattern # contains tag if tag in pattern
and ( and (
etree.parse(file).find(f"//tag[@key='{tag}']") any(
map(
lambda xml_file_with_ending: etree.parse(
xml_file_with_ending
).find(f".//tag[@key='{tag}']")
is not None,
xml_file.parent.glob(f"{xml_file.name}.*.xml"),
)
)
if tag != "" if tag != ""
else True else True
) )
# Not just matching an empty line # Not just matching an empty xml_file
and len(str(line)) > 0, and len(str(xml_file)) > 0,
all_xml, all_xml,
): ):
matching_files.add(str(line)) matching_files.add(str(xml_file))
for file in Path("").glob(f"{base}.??.xhtml"): for file in Path("").glob(f"{base}.??.xhtml"):
xslt_root = etree.parse(file) xslt_root = etree.parse(file)