[macro] Improve parameter extraction
This commit is contained in:
parent
6ee1c81da9
commit
97770e094e
|
@ -14,7 +14,7 @@ $(function() {
|
|||
self.macroName = ko.observable();
|
||||
|
||||
var paramObjRegex = /{(.*?)}/g;
|
||||
var keyValueRegex = /(\w*)\s*:\s*([\w°"|]*)/g;
|
||||
var keyValueRegex = /(\w*)\s*:\s*([\w\s°"|]*)/g;
|
||||
|
||||
self.process = function(macro) {
|
||||
self.macro = macro.macro();
|
||||
|
@ -29,9 +29,9 @@ $(function() {
|
|||
|
||||
while (res != null) {
|
||||
if("options" == res[1]) {
|
||||
obj["options"] = res[2].split("|");
|
||||
obj["options"] = res[2].trim().split("|");
|
||||
} else {
|
||||
obj[res[1]] = res[2];
|
||||
obj[res[1]] = res[2].trim();
|
||||
}
|
||||
res = keyValueRegex.exec(matches[i]);
|
||||
}
|
||||
|
|
|
@ -97,8 +97,8 @@
|
|||
<pre>
|
||||
PID_CALIBRATE
|
||||
HEATER={label:Heater, default:extruder, options:extruder|extruder1}
|
||||
TARGET={label:Temperature, unit:°C, default:190}
|
||||
WRITE_FILE={label:WriteFile, default:0, options:0|1}
|
||||
TARGET={label:Target Temperature, unit:°C, default:190}
|
||||
WRITE_FILE={label:Write to File, default:0, options:0|1}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue