Compare commits
2 Commits
e9f6f3dc7c
...
75b5c0cde0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
75b5c0cde0 | ||
![]() |
0beac7a12b |
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user