Improve params pattern to catch more macros ()

The current pattern can only take into account params followed by default. The proposal catches more parameters and removes white spaces if present.
This commit is contained in:
Frédéric Beaucamp 2024-03-09 16:31:51 +01:00 committed by GitHub
parent 97b4b544cb
commit 84f7c1acff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -80,7 +80,7 @@ class Panel(ScreenPanel):
"row": row, "row": row,
"params": {}, "params": {},
} }
pattern = r'params\.(?P<param>..*)\|default\((?P<default>..*)\).*' pattern = r'params\.(?P<param>[A-Z_0-9]+)(?:\s*\|.*\s*default\(\s*(?P<default>[^\)]+)\))?'
i = 0 i = 0
for line in gcode: for line in gcode:
if line.startswith("{") and "params." in line: if line.startswith("{") and "params." in line: