From 7b00d3259485d73f36c96eb5890e3e91c298698b Mon Sep 17 00:00:00 2001 From: Asa Rentschler Date: Thu, 19 Sep 2024 15:28:29 -0400 Subject: [PATCH] Fix cases where conditionals were wiping out the whole line and cases where '\' were breaking podman builds --- src/velocity/_backends.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/velocity/_backends.py b/src/velocity/_backends.py index e62174d..b7384f3 100644 --- a/src/velocity/_backends.py +++ b/src/velocity/_backends.py @@ -89,7 +89,7 @@ def _filter_content(cls, image: Image, text: str) -> str: res: re_Match[str] = re_match(r".*(\?\?([\S ]*)\|>(.*)\?\?).*", text) if res is not None: if image.satisfies(res.group(2)): - text = re_sub(r".*(\?\?.*\?\?).*", res.group(3), text) + text = re_sub(r"(\?\?.*\?\?)", res.group(3).strip(), text) else: text = "" @@ -290,7 +290,7 @@ def _run(self, contents: list[str], label_contents: list[str]) -> list[str]: ln += " " ln += alt_cmd # add '&& \\' to all but the last line - if cmd != contents[-1]: + if cmd != contents[-1] and cmd[-1] != '\\': # ignore line that end in an escape ln += " && \\" ret.append(ln) return ret