SVGHMI: multiple non significant changes: doc fixes, modern style access to attributes, enforce double quotes around member name in object literals.
authorEdouard Tisserant
Mon, 08 Nov 2021 14:09:44 +0100
changeset 3386 608f48ad3dfc
parent 3385 18621ce81f5f
child 3387 ecefd38d5c7d
SVGHMI: multiple non significant changes: doc fixes, modern style access to attributes, enforce double quotes around member name in object literals.
svghmi/widget_jsontable.ysl2
svghmi/widget_list.ysl2
svghmi/widget_switch.ysl2
--- a/svghmi/widget_jsontable.ysl2	Mon Nov 08 14:06:29 2021 +0100
+++ b/svghmi/widget_jsontable.ysl2	Mon Nov 08 14:09:44 2021 +0100
@@ -6,7 +6,7 @@
     Send given variables as POST to http URL argument, spread returned JSON in
     SVG sub-elements of "data" labeled element.
     
-    Documentation to be written. see svbghmi exemple.
+    Documentation to be written. see svghmi exemple.
     ||
 
     shortdesc > Http POST variables, spread JSON back
@@ -151,15 +151,15 @@
 
 template "svg:use", mode="json_table_elt_render" {
     param "expressions";
-    // cloned element must be part of a HMI:List
+    // cloned element must be part of a HMI:List or a HMI:List
     const "targetid", "substring-after(@xlink:href,'#')";
     const "from_list", "$hmi_lists[(@id | */@id) = $targetid]";
 
     choose {
         when "count($from_list) > 0" {
-            |         id("«@id»").setAttribute("xlink:href",
+            |         id("«@id»").href.baseVal =
             // obtain new target id from HMI:List widget
-            |             "#"+hmi_widgets["«$from_list/@id»"].items[«$expressions/expression[1]/@content»]);
+            |             "#"+hmi_widgets["«$from_list/@id»"].items[«$expressions/expression[1]/@content»];
         }
         otherwise
             warning > Clones (svg:use) in JsonTable Widget must point to a valid HMI:List widget or item. Reference "«@xlink:href»" is not valid and will not be updated.
--- a/svghmi/widget_list.ysl2	Mon Nov 08 14:06:29 2021 +0100
+++ b/svghmi/widget_list.ysl2	Mon Nov 08 14:09:44 2021 +0100
@@ -22,7 +22,7 @@
 widget_defs("List") {
     |     items: {
     foreach "$hmi_element/*[@inkscape:label]" {
-    |         «@inkscape:label»: "«@id»",
+    |         "«@inkscape:label»": "«@id»",
     }
     |     },
 }
--- a/svghmi/widget_switch.ysl2	Mon Nov 08 14:06:29 2021 +0100
+++ b/svghmi/widget_switch.ysl2	Mon Nov 08 14:09:44 2021 +0100
@@ -11,7 +11,7 @@
     '"hello"' or '"hello"#another comment' match HMI_STRING 'hello'.
     ||
 
-    shortdesc > Show elements whose label match value.
+    shortdesc > Show elements whose label matches value.
 
     // TODO: add optional format/precision argument to support floating points
     // TODO: support (in)equations and ranges