diff options
author | Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> | 2019-03-12 23:36:46 +0200 |
---|---|---|
committer | Olivier Hallot <olivier.hallot@libreoffice.org> | 2019-03-13 20:11:32 +0100 |
commit | 3d0fcf7a37859e0e8b61d4a560042dfef6b3c99b (patch) | |
tree | d841577c702391701d5671640b44975f2b11c290 /help3xsl/online_transform.xsl | |
parent | 669ede5358fc7aa63420bd61b62548f2d0b54519 (diff) |
New approach to switch cases
My previous JS patch broke the sys and appl switch behaviour.
This patch removes the inline function calls from
online_transform.xsl. Instead, help2.js now finds the relevant spans
and calls the functions for them.
Change-Id: I45d5b75bdb70a7c18eaa0b215beb57e3e1b6719a
Reviewed-on: https://gerrit.libreoffice.org/69137
Tested-by: Jenkins
Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl/online_transform.xsl')
-rw-r--r-- | help3xsl/online_transform.xsl | 145 |
1 files changed, 67 insertions, 78 deletions
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl index 33a9537d34..f3b71bac9c 100644 --- a/help3xsl/online_transform.xsl +++ b/help3xsl/online_transform.xsl @@ -162,7 +162,8 @@ </head> <body itemscope="true" itemtype="http://schema.org/TechArticle"> <xsl:if test="$online"> - <meta itemprop="version" content="{$productversion}"/><!-- This is used by help2.js to test, if we are online --> + <!-- help2.js checks, if meta elements exist in the body --> + <meta itemprop="version" content="{$productversion}"/> <meta itemprop="inLanguage" content="{$lang}"/> <meta itemprop="datePublished" content="2017"/> <meta itemprop="headline" content="{$titleL10N}"/> @@ -615,94 +616,82 @@ <!-- SWITCH --> <xsl:template match="switch"> - <xsl:variable name="idsw" select="concat('swln',generate-id())"/> - <span id="{$idsw}" class="switch"> - <xsl:choose> - <xsl:when test ="@select = 'sys'"> - <xsl:apply-templates /> - <script type="text/javascript"> - <![CDATA[setSystemSpan("]]><xsl:value-of select="$idsw"/><![CDATA[");]]> - </script> - </xsl:when> - <xsl:when test ="@select = 'appl'"> + <xsl:choose> + <xsl:when test ="@select = 'sys'"> + <xsl:variable name="idsw" select="concat('swlnsys',generate-id())"/> + <span id="{$idsw}" class="switch"> <xsl:apply-templates /> - <script type="text/javascript"> - <![CDATA[setApplSpan("]]><xsl:value-of select="$idsw"/><![CDATA[");]]> - </script> - </xsl:when> - <xsl:otherwise> + </span> + </xsl:when> + <xsl:when test ="@select = 'appl'"> + <xsl:variable name="idsw" select="concat('swlnappl',generate-id())"/> + <span id="{$idsw}" class="switch"> <xsl:apply-templates /> - </xsl:otherwise> - </xsl:choose> - </span> + </span> + </xsl:when> + <xsl:otherwise> + <p class="debug">Unsupported switch condition.</p> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="switch" mode="embedded"> - <xsl:variable name="idsw" select="concat('swln',generate-id())"/> - <span id="{$idsw}" class="switch"> - <xsl:choose> - <xsl:when test ="@select = 'sys'"> + <xsl:choose> + <xsl:when test ="@select = 'sys'"> + <xsl:variable name="idsw" select="concat('swlnsys',generate-id())"/> + <span id="{$idsw}" class="switch"> <xsl:apply-templates mode="embedded"/> - <script type="text/javascript"> - <![CDATA[setSystemSpan("]]><xsl:value-of select="$idsw"/><![CDATA[");]]> - </script> - </xsl:when> - <xsl:when test ="@select = 'appl'"> - <xsl:apply-templates /> - <script type="text/javascript"> - <![CDATA[setApplSpan("]]><xsl:value-of select="$idsw"/><![CDATA[");]]> - </script> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates /> - </xsl:otherwise> - </xsl:choose> - </span> + </span> + </xsl:when> + <xsl:when test ="@select = 'appl'"> + <xsl:variable name="idsw" select="concat('swlnappl',generate-id())"/> + <span id="{$idsw}" class="switch"> + <xsl:apply-templates mode="embedded"/> + </span> + </xsl:when> + <xsl:otherwise> + <p class="debug">Unsupported switch condition.</p> + </xsl:otherwise> + </xsl:choose> </xsl:template> <!-- SWITCHINLINE --> <xsl:template match="switchinline"> - <xsl:variable name="idsw" select="concat('swln',generate-id())"/> - <span id="{$idsw}" class="switchinline"> - <xsl:choose> - <xsl:when test ="@select = 'sys'"> + <xsl:choose> + <xsl:when test ="@select = 'sys'"> + <xsl:variable name="idsw" select="concat('swlnsys',generate-id())"/> + <span id="{$idsw}" class="switchinline"> <xsl:apply-templates /> - <script type="text/javascript"> - <![CDATA[setSystemSpan("]]><xsl:value-of select="$idsw"/><![CDATA[");]]> - </script> - </xsl:when> - <xsl:when test ="@select = 'appl'"> + </span> + </xsl:when> + <xsl:when test ="@select = 'appl'"> + <xsl:variable name="idsw" select="concat('swlnappl',generate-id())"/> + <span id="{$idsw}" class="switchinline"> <xsl:apply-templates /> - <script type="text/javascript"> - <![CDATA[setApplSpan("]]><xsl:value-of select="$idsw"/><![CDATA[");]]> - </script> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates /> - </xsl:otherwise> - </xsl:choose> - </span> + </span> + </xsl:when> + <xsl:otherwise> + <p class="debug">Unsupported switch condition.</p> + </xsl:otherwise> + </xsl:choose> </xsl:template> <xsl:template match="switchinline" mode="embedded"> - <xsl:variable name="idsw" select="concat('swln',generate-id())"/> - <span id="{$idsw}" class="switchinline"> - <xsl:choose> - <xsl:when test ="@select = 'sys'"> - <xsl:apply-templates /> - <script type="text/javascript"> - <![CDATA[setSystemSpan("]]><xsl:value-of select="$idsw"/><![CDATA[");]]> - </script> - </xsl:when> - <xsl:when test ="@select = 'appl'"> - <xsl:apply-templates /> - <script type="text/javascript"> - <![CDATA[setApplSpan("]]><xsl:value-of select="$idsw"/><![CDATA[");]]> - </script> - </xsl:when> - <xsl:otherwise> - <xsl:apply-templates /> - </xsl:otherwise> - </xsl:choose> - </span> + <xsl:choose> + <xsl:when test ="@select = 'sys'"> + <xsl:variable name="idsw" select="concat('swlnsys',generate-id())"/> + <span id="{$idsw}" class="switchinline"> + <xsl:apply-templates mode="embedded"/> + </span> + </xsl:when> + <xsl:when test ="@select = 'appl'"> + <xsl:variable name="idsw" select="concat('swlnappl',generate-id())"/> + <span id="{$idsw}" class="switchinline"> + <xsl:apply-templates mode="embedded"/> + </span> + </xsl:when> + <xsl:otherwise> + <p class="debug">Unsupported switch condition.</p> + </xsl:otherwise> + </xsl:choose> </xsl:template> <!-- TABLE --> @@ -1017,10 +1006,10 @@ <xsl:variable name="auxID" select="concat(@select,generate-id())"/> <xsl:choose> <xsl:when test="$embedded = 'yes'"> - <span hidden="true" id="{$auxID}"><xsl:apply-templates mode="embedded"/></span> + <span hidden="true" id="{$auxID}" class="{@select}"><xsl:apply-templates mode="embedded"/></span> </xsl:when> <xsl:otherwise> - <span hidden="true" id="{$auxID}"><xsl:apply-templates/></span> + <span hidden="true" id="{$auxID}" class="{@select}"><xsl:apply-templates/></span> </xsl:otherwise> </xsl:choose> </xsl:template> |