From 97770e094e237823a5b6a4687aca15d3925820fe Mon Sep 17 00:00:00 2001 From: Martin Muehlhaeuser Date: Sat, 25 Aug 2018 19:16:03 +0000 Subject: [PATCH] [macro] Improve parameter extraction --- octoprint_klipper/static/js/klipper_param_macro.js | 6 +++--- octoprint_klipper/templates/klipper_settings.jinja2 | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/octoprint_klipper/static/js/klipper_param_macro.js b/octoprint_klipper/static/js/klipper_param_macro.js index 977052e..502b3cb 100644 --- a/octoprint_klipper/static/js/klipper_param_macro.js +++ b/octoprint_klipper/static/js/klipper_param_macro.js @@ -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]); } diff --git a/octoprint_klipper/templates/klipper_settings.jinja2 b/octoprint_klipper/templates/klipper_settings.jinja2 index dcac2f5..5b6051d 100644 --- a/octoprint_klipper/templates/klipper_settings.jinja2 +++ b/octoprint_klipper/templates/klipper_settings.jinja2 @@ -95,10 +95,10 @@
-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}