--- a/svghmi/hmi_tree.ysl2 Tue Aug 02 11:53:37 2022 +0200
+++ b/svghmi/hmi_tree.ysl2 Thu Aug 11 12:11:35 2022 +0200
@@ -121,6 +121,7 @@
> «$indent» «local-name()»
foreach "@*" > «local-name()»="«.»"
+ if "text()" > «text()»\n apply "*", mode="testtree" {
with "indent" value "concat($indent,'>')"
--- a/svghmi/parse_labels.ysl2 Tue Aug 02 11:53:37 2022 +0200
+++ b/svghmi/parse_labels.ysl2 Thu Aug 11 12:11:35 2022 +0200
@@ -15,9 +15,29 @@
const "pathregex",!"'^([^\[,]+)(\[[^\]]+\])?([-.\d,]*)$'"!;
+const "twonewlines", "concat($newline,$newline)"; template "*", mode="parselabel"
- const "label","@inkscape:label";
+ const "part","@inkscape:label"; + const "desc", "svg:desc"; + // add svg:desc field if continuation "\" marker is found at the end of label + const "len","string-length($part)"; + const "has_continuation", "substring($part,$len,1)='\\'"; + when "$has_continuation" { + const "_continuation", "substring-before($desc, $twonewlines)"; + const "continuation" choose { + when "$_continuation" value "$_continuation"; + otherwise value "$desc"; + value "concat(substring($part,1,$len - 1),translate($continuation,$newline,''))"; + otherwise value "$part"; const "description", "substring-after($label,'HMI:')";
@@ -100,7 +120,15 @@
- if "svg:desc" desc value "svg:desc/text()";
+ when "$has_continuation" { + const "_continuation", "substring-after($desc, $twonewlines)"; + desc value "$_continuation"; + if "$desc" desc value "$desc/text()"; --- a/tests/projects/svghmi_scrollbar/svghmi_0@svghmi/svghmi.svg Tue Aug 02 11:53:37 2022 +0200
+++ b/tests/projects/svghmi_scrollbar/svghmi_0@svghmi/svghmi.svg Thu Aug 11 12:11:35 2022 +0200
@@ -60,12 +60,12 @@
- inkscape:cx="-438.80601"
- inkscape:cy="183.59799"
- inkscape:window-width="3200"
- inkscape:window-height="1672"
+ inkscape:cx="476.03774" + inkscape:cy="444.53549" + inkscape:window-width="1600" + inkscape:window-height="836"
inkscape:window-maximized="1"
inkscape:guide-bbox="true"
@@ -745,8 +745,14 @@
- inkscape:label="HMI:ScrollBar@.range@.position@.size"
+ inkscape:label="HMI:ScrollBar\" transform="translate(-202)">
+my tailor is rich</desc> @@ -857,6 +863,9 @@
inkscape:label="HMI:ScrollBar@.range@.position@.size"
+ id="desc149">deedewesfsdf style="opacity:1;vector-effect:none;fill:#ff35ff;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none"