From 84f7c1acffe1c0ffddfbd283dfb23b21f4b11b8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Beaucamp?=
<88246672+fbeauKmi@users.noreply.github.com>
Date: Sat, 9 Mar 2024 16:31:51 +0100
Subject: [PATCH] Improve params pattern to catch more macros (#1295)
The current pattern can only take into account params followed by default. The proposal catches more parameters and removes white spaces if present.
---
panels/gcode_macros.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/panels/gcode_macros.py b/panels/gcode_macros.py
index f1c693a2..f3a7bd4c 100644
--- a/panels/gcode_macros.py
+++ b/panels/gcode_macros.py
@@ -80,7 +80,7 @@ class Panel(ScreenPanel):
"row": row,
"params": {},
}
- pattern = r'params\.(?P..*)\|default\((?P..*)\).*'
+ pattern = r'params\.(?P[A-Z_0-9]+)(?:\s*\|.*\s*default\(\s*(?P[^\)]+)\))?'
i = 0
for line in gcode:
if line.startswith("{") and "params." in line: