# HG changeset patch # User Edouard Tisserant # Date 1583249362 -3600 # Node ID f7349ca820c910296680e7060bd8d07285cf5dee # Parent 8d15c6238e627acab867730f4d0747286c1508f3 SVGHMI: completely fixed indentation of generated widget description. Lets try to keep it as-is until we can use yslt indentation. diff -r 8d15c6238e62 -r f7349ca820c9 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Tue Mar 03 10:58:00 2020 +0100 +++ b/svghmi/gen_index_xhtml.xslt Tue Mar 03 16:29:22 2020 +0100 @@ -261,9 +261,13 @@ - + + + + + @@ -319,7 +323,7 @@ - + //(function(){ @@ -336,18 +340,18 @@ - " + " ": { - type: " + type: " ", - args: [ + args: [ - " + " " @@ -356,9 +360,9 @@ - ], - - indexes: [ + ], + + indexes: [ @@ -457,15 +461,15 @@ - " + " ": { - widget: hmi_widgets[" + widget: hmi_widgets[" "], - bbox: [ + bbox: [ , @@ -475,10 +479,10 @@ ], - widgets: [ + widgets: [ - hmi_widgets[" + hmi_widgets[" "] @@ -487,12 +491,12 @@ - ], - - required_detachables: { + ], + + required_detachables: { - " + " ": detachable_elements[" @@ -503,9 +507,9 @@ - } - - } + } + + } , @@ -1173,6 +1177,7 @@ + _elt: id(" @@ -1184,13 +1189,13 @@ - frequency: 5, - - dispatch: function(value) { + frequency: 5, + + dispatch: function(value) { - this.element.textContent = String(value); + this.element.textContent = String(value); @@ -1199,12 +1204,12 @@ - }, + }, - frequency: 10, + frequency: 10, @@ -1212,31 +1217,31 @@ value min max needle range - dispatch: function(value) { - - this.value_elt.textContent = String(value); - - let [min,max,totallength] = this.range; - - let length = Math.max(0,Math.min(totallength,(Number(value)-min)*totallength/(max-min))); - - let tip = this.range_elt.getPointAtLength(length); - - this.needle_elt.setAttribute('d', "M "+this.origin.x+","+this.origin.y+" "+tip.x+","+tip.y); - - }, - - origin: undefined, - - range: undefined, - - init: function() { - - this.range = [Number(this.min_elt.textContent), Number(this.max_elt.textContent), this.range_elt.getTotalLength()] - - this.origin = this.needle_elt.getPointAtLength(0); - - }, + dispatch: function(value) { + + this.value_elt.textContent = String(value); + + let [min,max,totallength] = this.range; + + let length = Math.max(0,Math.min(totallength,(Number(value)-min)*totallength/(max-min))); + + let tip = this.range_elt.getPointAtLength(length); + + this.needle_elt.setAttribute('d', "M "+this.origin.x+","+this.origin.y+" "+tip.x+","+tip.y); + + }, + + origin: undefined, + + range: undefined, + + init: function() { + + this.range = [Number(this.min_elt.textContent), Number(this.max_elt.textContent), this.range_elt.getTotalLength()] + + this.origin = this.needle_elt.getPointAtLength(0); + + }, diff -r 8d15c6238e62 -r f7349ca820c9 svghmi/gen_index_xhtml.ysl2 --- a/svghmi/gen_index_xhtml.ysl2 Tue Mar 03 10:58:00 2020 +0100 +++ b/svghmi/gen_index_xhtml.ysl2 Tue Mar 03 16:29:22 2020 +0100 @@ -484,13 +484,13 @@ | var hmi_widgets = { foreach "$hmi_elements" { const "widget", "func:parselabel(@inkscape:label)/widget"; - | "«@id»": { - | type: "«$widget/@type»", - | args: [ + | "«@id»": { + | type: "«$widget/@type»", + | args: [ foreach "$widget/arg" - | "«@value»"`if "position()!=last()" > ,` - | ], - | indexes: [ + | "«@value»"`if "position()!=last()" > ,` + | ], + | indexes: [ foreach "$widget/path" { const "hmipath","@value"; const "hmitree_match","$indexed_hmitree/*[@hmipath = $hmipath]"; @@ -541,20 +541,20 @@ const "required_detachables", "func:sumarized_elements($page_all_elements)"; - | "«$desc/arg[1]/@value»": { - | widget: hmi_widgets["«@id»"], - | bbox: [«$p/@x», «$p/@y», «$p/@w», «$p/@h»], - | widgets: [ + | "«$desc/arg[1]/@value»": { + | widget: hmi_widgets["«@id»"], + | bbox: [«$p/@x», «$p/@y», «$p/@w», «$p/@h»], + | widgets: [ foreach "$all_page_ids" { - | hmi_widgets["«.»"]`if "position()!=last()" > ,` - } - | ], - | required_detachables: { + | hmi_widgets["«.»"]`if "position()!=last()" > ,` + } + | ], + | required_detachables: { foreach "$required_detachables" { - | "«@id»": detachable_elements["«@id»"]`if "position()!=last()" > ,` - } - | } - | }`if "position()!=last()" > ,` + | "«@id»": detachable_elements["«@id»"]`if "position()!=last()" > ,` + } + | } + | }`if "position()!=last()" > ,` } | } @@ -629,7 +629,7 @@ // otherwise produce nothing } otherwise { - | «$name»_elt: id("«$elt_id»"), + | «$name»_elt: id("«$elt_id»"), } } } @@ -638,38 +638,37 @@ template "widget[@type='Display']", mode="widget_defs" { param "hmi_element"; - | frequency: 5, - | dispatch: function(value) { + | frequency: 5, + | dispatch: function(value) { choose { when "$hmi_element[self::svg:text]"{ // TODO : care about ? - | this.element.textContent = String(value); + | this.element.textContent = String(value); } otherwise { warning > Display widget as a group not implemented } } - | }, + | }, } template "widget[@type='Meter']", mode="widget_defs" { param "hmi_element"; - | frequency: 10, + | frequency: 10, labels("value min max needle range"); - | dispatch: function(value) { - | this.value_elt.textContent = String(value); - | let [min,max,totallength] = this.range; - | let length = Math.max(0,Math.min(totallength,(Number(value)-min)*totallength/(max-min))); - | let tip = this.range_elt.getPointAtLength(length); - // TODO : deal with transformations between needle and range - | this.needle_elt.setAttribute('d', "M "+this.origin.x+","+this.origin.y+" "+tip.x+","+tip.y); - | }, - | origin: undefined, - | range: undefined, - | init: function() { - | this.range = [Number(this.min_elt.textContent), Number(this.max_elt.textContent), this.range_elt.getTotalLength()] - | this.origin = this.needle_elt.getPointAtLength(0); - | }, + | dispatch: function(value) { + | this.value_elt.textContent = String(value); + | let [min,max,totallength] = this.range; + | let length = Math.max(0,Math.min(totallength,(Number(value)-min)*totallength/(max-min))); + | let tip = this.range_elt.getPointAtLength(length); + | this.needle_elt.setAttribute('d', "M "+this.origin.x+","+this.origin.y+" "+tip.x+","+tip.y); + | }, + | origin: undefined, + | range: undefined, + | init: function() { + | this.range = [Number(this.min_elt.textContent), Number(this.max_elt.textContent), this.range_elt.getTotalLength()] + | this.origin = this.needle_elt.getPointAtLength(0); + | }, } def "func:escape_quotes" {