Skip to content

Commit

Permalink
Allow boolean SLOTHY tags within macros
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hanno-becker authored and mkannwischer committed Dec 20, 2024
1 parent f58e6b3 commit bbfd70b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions slothy/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("\\()\\()", "\\()")
Expand Down

0 comments on commit bbfd70b

Please sign in to comment.