# HG changeset patch # User Edouard Tisserant # Date 1728631894 -7200 # Node ID f9c6bbf66eea3b041c1b9922ef823ae8865b11e5 # Parent b344393859df4a7fe3adac4a7c5a934a61e5c649 SVGHMI: code cleanup diff -r b344393859df -r f9c6bbf66eea svghmi/hmi_tree.ysl2 --- a/svghmi/hmi_tree.ysl2 Mon Sep 30 16:21:11 2024 +0200 +++ b/svghmi/hmi_tree.ysl2 Fri Oct 11 09:31:34 2024 +0200 @@ -6,12 +6,6 @@ // HMI Tree computed from VARIABLES.CSV in svghmi.py const "hmitree", "ns:GetHMITree()"; -const "_categories" { - noindex > HMI_PLC_STATUS - noindex > HMI_CURRENT_PAGE -} -const "categories", "exsl:node-set($_categories)"; - // HMI Tree Index const "_indexed_hmitree" apply "$hmitree", mode="index"; const "indexed_hmitree", "exsl:node-set($_indexed_hmitree)"; @@ -49,30 +43,19 @@ param "index", "0"; param "parentpath", "''"; const "content" { - const "path" - choose { - when "count(ancestor::*)=0" > / - when "count(ancestor::*)=1" > /«@name» - otherwise > «$parentpath»/«@name» - } - choose { - when "not(local-name() = $categories/noindex)" { - xsl:copy { - attrib "index" > «$index» - attrib "hmipath" > «$path» - foreach "@*" xsl:copy; - } - apply "*[1]", mode="index"{ - with "index", "$index + 1"; - with "parentpath" > «$path» - } - } - otherwise { - apply "*[1]", mode="index"{ - with "index", "$index"; - with "parentpath" > «$path» - } - } + const "path" choose { + when "count(ancestor::*)=0" > / + when "count(ancestor::*)=1" > /«@name» + otherwise > «$parentpath»/«@name» + } + xsl:copy { + attrib "index" > «$index» + attrib "hmipath" > «$path» + foreach "@*" xsl:copy; + } + apply "*[1]", mode="index"{ + with "index", "$index + 1"; + with "parentpath" > «$path» } } diff -r b344393859df -r f9c6bbf66eea svghmi/parse_labels.ysl2 --- a/svghmi/parse_labels.ysl2 Mon Sep 30 16:21:11 2024 +0200 +++ b/svghmi/parse_labels.ysl2 Fri Oct 11 09:31:34 2024 +0200 @@ -99,8 +99,8 @@ if "string-length(.) > 0" path { // 1 : global match // 2 : assign= - // 2 : /path - // 3 : min,max + // 3 : /path + // 4 : min,max const "path_match", "regexp:match(.,$pathregex)"; const "pathassign", "substring-before($path_match[2],'=')"; const "pathminmax", "str:split($path_match[4],',')"; diff -r b344393859df -r f9c6bbf66eea svghmi/widgets_common.ysl2 --- a/svghmi/widgets_common.ysl2 Mon Sep 30 16:21:11 2024 +0200 +++ b/svghmi/widgets_common.ysl2 Fri Oct 11 09:31:34 2024 +0200 @@ -348,7 +348,7 @@ this.relativeness = undefined; } - sub(new_offset=0, relativeness, container_id){ + sub(new_offset, relativeness, container_id){ this.offset = new_offset; this.relativeness = relativeness; this.container_id = container_id ;