[Libreoffice-commits] help.git: help3xsl/help.js help3xsl/online_transform.xsl

Olivier Hallot olivier.hallot at libreoffice.org
Sat Mar 3 10:15:34 UTC 2018


 help3xsl/help.js              |   21 ++++++++++++++++++---
 help3xsl/online_transform.xsl |   30 +++++++++++++++---------------
 2 files changed, 33 insertions(+), 18 deletions(-)

New commits:
commit 13098ccef163c813ae3e196511f44a16a6e73fdd
Author: Olivier Hallot <olivier.hallot at libreoffice.org>
Date:   Fri Mar 2 19:20:42 2018 -0300

    tdf#116150 Fix logic for case/caseinline with 'sys'
    
    Change-Id: I5c9cb270fa89ea5281355fc80be2a155b9d9ef9e
    Reviewed-on: https://gerrit.libreoffice.org/50650
    Reviewed-by: Olivier Hallot <olivier.hallot at libreoffice.org>
    Tested-by: Olivier Hallot <olivier.hallot at libreoffice.org>

diff --git a/help3xsl/help.js b/help3xsl/help.js
index 9329f2d0f..838605526 100644
--- a/help3xsl/help.js
+++ b/help3xsl/help.js
@@ -19,16 +19,31 @@ function setModule(module) {
         }
     }
 }
-// Used to set system in caseinline=SYSTEM
+// Used to set system in case, caseinline=SYSTEM
 function setSystem(system) {
-    var itemspan = document.getElementsByTagName("span");
+    var hasSystem;
+    // if no System in URL, get browser system
     if (system === null) {
-        system = "WIN";
+        system = getSystem();
     }
+    // on loading page, DEFAULTSYS visible, sys is hidden
+    // when hasSystem, show sys, hide DEFAULTSYS
+    var itemspan = document.getElementsByTagName("span");
     var n = itemspan.length;
+    //Show  when system is found in page
+    hasSystem = false;
     for (var i = 0; i < n; i++) {
         if (itemspan[i].getAttribute("value") == system) {
             itemspan[i].removeAttribute("hidden");
+            hasSystem = true;
+        }
+    }
+    //it hasSystem, then hide all DEFAULTSYS
+    if (hasSystem){
+        for (var i = 0; i < n; i++) {
+            if (itemspan[i].getAttribute("value") == "DEFAULTSYS") {
+                itemspan[i].setAttribute("hidden",true);
+            }
         }
     }
 }
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index 0b9eed254..cd4774897 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -400,9 +400,9 @@
 <!-- CASE -->
 <xsl:template match="case"><xsl:call-template name="insertcase" /></xsl:template>
 <xsl:template match="case" mode="embedded">
-	<xsl:call-template name="insertcase">
-		<xsl:with-param name="embedded" select="'yes'"/>
-	</xsl:call-template>
+        <xsl:call-template name="insertcase">
+            <xsl:with-param name="embedded" select="'yes'"/>
+        </xsl:call-template>
 </xsl:template>
 
 <!-- CASEINLINE -->
@@ -667,16 +667,16 @@
 
 <!-- SECTION -->
 <xsl:template match="section" mode="embedded">
-	<a name="{@id}"></a>
-	<xsl:apply-templates mode="embedded"/>
+    <a name="{@id}"></a>
+    <xsl:apply-templates mode="embedded"/>
 </xsl:template>
 
 <!-- SORT -->
 <xsl:template match="sort" >
-	<xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
+    <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
 </xsl:template>
 <xsl:template match="sort" mode="embedded">
-	<xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
+    <xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
 </xsl:template>
 
 <!-- SWITCH -->
@@ -712,15 +712,15 @@
 <xsl:template match="variable" mode="embedded"><a name="{@id}"></a><xsl:apply-templates mode="embedded"/></xsl:template>
 
 <xsl:template match="text()">
-	<xsl:call-template name="brand">
-		<xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
-	</xsl:call-template>
+    <xsl:call-template name="brand">
+        <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
 </xsl:template>
 
 <xsl:template match="text()" mode="embedded">
-	<xsl:call-template name="brand">
-		<xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
-	</xsl:call-template>
+    <xsl:call-template name="brand">
+        <xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
+    </xsl:call-template>
 </xsl:template>
 
 <!-- In case of missing help files -->
@@ -963,10 +963,10 @@
             <xsl:if test="not(../child::case[@select=$System]) and not(../child::caseinline[@select=$System])">
                 <xsl:choose>
                     <xsl:when test="$embedded = 'yes'">
-                        <span hidden="true" itemprop="system" value="WIN"><xsl:apply-templates mode="embedded"/></span>
+                        <span itemprop="system" value="DEFAULTSYS"><xsl:apply-templates mode="embedded"/></span>
                     </xsl:when>
                     <xsl:otherwise>
-                        <span hidden="true" itemprop="system" value="WIN"><xsl:apply-templates /></span>
+                        <span itemprop="system" value="DEFAULTSYS"><xsl:apply-templates /></span>
                     </xsl:otherwise>
                 </xsl:choose>
             </xsl:if>


More information about the Libreoffice-commits mailing list