svghmi/gen_index_xhtml.xslt
branchwxPython4
changeset 3582 7dcd0de97e6f
parent 3558 f5850ce25caf
child 3615 5c983ead9db0
--- a/svghmi/gen_index_xhtml.xslt	Fri Aug 12 13:35:59 2022 +0200
+++ b/svghmi/gen_index_xhtml.xslt	Fri Aug 12 16:52:15 2022 +0200
@@ -160,8 +160,37 @@
     </xsl:apply-templates>
   </xsl:template>
   <xsl:variable name="pathregex" select="'^([^\[,]+)(\[[^\]]+\])?([-.\d,]*)$'"/>
+  <xsl:variable name="newline">
+    <xsl:text>
+</xsl:text>
+  </xsl:variable>
+  <xsl:variable name="twonewlines" select="concat($newline,$newline)"/>
   <xsl:template mode="parselabel" match="*">
-    <xsl:variable name="label" select="@inkscape:label"/>
+    <xsl:variable name="part" select="@inkscape:label"/>
+    <xsl:variable name="desc" select="svg:desc"/>
+    <xsl:variable name="len" select="string-length($part)"/>
+    <xsl:variable name="has_continuation" select="substring($part,$len,1)='\'"/>
+    <xsl:variable name="label">
+      <xsl:choose>
+        <xsl:when test="$has_continuation">
+          <xsl:variable name="_continuation" select="substring-before($desc, $twonewlines)"/>
+          <xsl:variable name="continuation">
+            <xsl:choose>
+              <xsl:when test="$_continuation">
+                <xsl:value-of select="$_continuation"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:value-of select="$desc"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:variable>
+          <xsl:value-of select="concat(substring($part,1,$len - 1),translate($continuation,$newline,''))"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$part"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:variable>
     <xsl:variable name="id" select="@id"/>
     <xsl:variable name="description" select="substring-after($label,'HMI:')"/>
     <xsl:variable name="_args" select="substring-before($description,'@')"/>
@@ -305,11 +334,23 @@
             </path>
           </xsl:if>
         </xsl:for-each>
-        <xsl:if test="svg:desc">
-          <desc>
-            <xsl:value-of select="svg:desc/text()"/>
-          </desc>
-        </xsl:if>
+        <xsl:choose>
+          <xsl:when test="$has_continuation">
+            <xsl:variable name="_continuation" select="substring-after($desc, $twonewlines)"/>
+            <xsl:if test="$_continuation">
+              <desc>
+                <xsl:value-of select="$_continuation"/>
+              </desc>
+            </xsl:if>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:if test="$desc">
+              <desc>
+                <xsl:value-of select="$desc/text()"/>
+              </desc>
+            </xsl:if>
+          </xsl:otherwise>
+        </xsl:choose>
       </widget>
     </xsl:if>
   </xsl:template>
@@ -371,6 +412,11 @@
     </xsl:for-each>
     <xsl:text>
 </xsl:text>
+    <xsl:if test="text()">
+      <xsl:value-of select="text()"/>
+      <xsl:text>
+</xsl:text>
+    </xsl:if>
     <xsl:apply-templates mode="testtree" select="*">
       <xsl:with-param name="indent">
         <xsl:value-of select="concat($indent,'&gt;')"/>
@@ -5600,6 +5646,12 @@
 </xsl:text>
     <xsl:text>            this.disabled = !Number(value);
 </xsl:text>
+    <xsl:text>
+</xsl:text>
+    <xsl:text>            // TODO : use RequestAnimate and animate()
+</xsl:text>
+    <xsl:text>
+</xsl:text>
     <xsl:text>            this.update_state();
 </xsl:text>
     <xsl:text>        }
@@ -6347,6 +6399,8 @@
 </xsl:text>
     <xsl:text>        }
 </xsl:text>
+    <xsl:text>        // TODO : use RequestAnimate and animate()
+</xsl:text>
     <xsl:text>    }
 </xsl:text>
     <xsl:text>