Skip to content

Commit

Permalink
[macro] Improve parameter extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
mmone committed Aug 25, 2018
1 parent 6ee1c81 commit 97770e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions octoprint_klipper/static/js/klipper_param_macro.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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]);
}
Expand Down
6 changes: 3 additions & 3 deletions octoprint_klipper/templates/klipper_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@
</div>
<div class="control-group">
<pre>
PID_CALIBRATE
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>
Expand Down

0 comments on commit 97770e0

Please sign in to comment.