From bbfd70b1db4045158fbdd928fd5832c2635194e2 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Mon, 21 Oct 2024 11:38:37 +0100 Subject: [PATCH] Allow boolean SLOTHY tags within macros Previously, a boolean tag (like `// @slothy:core=True`) inside a macro would lead to failure upon trying to unfold macro arguments. This commit fixes this. --- slothy/helper.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/slothy/helper.py b/slothy/helper.py index c847ecc9..2601c81d 100644 --- a/slothy/helper.py +++ b/slothy/helper.py @@ -783,6 +783,9 @@ def prepare_value(a): return a def apply_arg(l, arg, val): + # This function is also called on the values of tags, which may not be strings. + if isinstance(l, str) is False: + return l l = re.sub(f"\\\\{arg}\\\\\\(\\)", val, l) l = re.sub(f"\\\\{arg}(\\W|$)",val + "\\1", l) l = l.replace("\\()\\()", "\\()")