help3xsl/default.css          |    1 
 help3xsl/online_transform.xsl |   53 +++++++++++++++++++++---------------------
 helpers/xmlhelp.dtd           |    5 +++
 3 files changed, 33 insertions(+), 26 deletions(-)

New commits:
commit a755e2c2ec426c9ce8412f29f2e1100437e4a44e
Author:     Olivier Hallot <[email protected]>
AuthorDate: Wed Sep 17 09:02:04 2025 -0300
Commit:     Olivier Hallot <[email protected]>
CommitDate: Wed Sep 17 15:57:26 2025 +0200

    tdf#168443 Add <meta> description in Help pages.
    
    - Add <description> to the DTD
    - Add code for <description> in XSLT
    - Add a .description class in CSS
    
    Change-Id: Iaad102d16488fa26fd9cca513faee215754f7f47
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/191083
    Reviewed-by: Olivier Hallot <[email protected]>
    Tested-by: Jenkins

diff --git a/help3xsl/default.css b/help3xsl/default.css
index 144471ed4c..43c9478562 100644
--- a/help3xsl/default.css
+++ b/help3xsl/default.css
@@ -57,6 +57,7 @@ h4,
 h5,
 h6,
 .listitem,
+.description,
 .listitemintable,
 .tablecontent {
     font-family: var(--font-body);
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index fd5862b115..bb4836ae91 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -122,7 +122,9 @@
 
 <!-- Create the document skeleton -->
 <xsl:template match="/">
-    <xsl:variable name="htmlpage"><xsl:value-of 
select="concat(substring-before($filename,'.xhp'),'.html')"/></xsl:variable>
+    <xsl:variable name="htmlpage">
+        <xsl:value-of 
select="concat(substring-before($filename,'.xhp'),'.html')"/>
+    </xsl:variable>
     <xsl:variable name="titleL10N">
         <xsl:call-template name="brand"><xsl:with-param 
name="string"><xsl:value-of 
select="$title"/></xsl:with-param></xsl:call-template>
     </xsl:variable>
@@ -147,14 +149,20 @@
             </xsl:otherwise>
         </xsl:choose>
     </xsl:variable>
+    <xsl:variable name="meta_description">
+        <xsl:value-of select="substring(concat($productname,': 
',//description),1,170)"/>
+    </xsl:variable>
 <html lang="{$lang}" dir="{$direction}">
     <head>
         <base href="{$install}"/>
+        <title><xsl:value-of disable-output-escaping="yes" 
select="$titleL10N"/></title>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+        <xsl:if test="//description">
+            <meta name="description" contents="{$meta_description}"/>
+        </xsl:if>
         <xsl:if test="$online">
             <meta http-equiv="Content-Security-Policy" content="script-src 
'self' 'unsafe-inline' 'unsafe-eval' piwik.documentfoundation.org"/>
         </xsl:if>
-        <title><xsl:value-of disable-output-escaping="yes" 
select="$titleL10N"/></title>
         <link rel="shortcut icon" href="media/navigation/favicon.ico"/>
         <link  type="text/css" href="normalize.css" rel="Stylesheet"/>
         <link  type="text/css" href="prism.css" rel="Stylesheet"/>
@@ -178,6 +186,7 @@
         <xsl:if test="//topic[@indexer='exclude']">
             <meta name="robots" content="noindex"/>
         </xsl:if>
+
     </head>
     <body>
 
@@ -842,6 +851,14 @@
     </div>
 </xsl:template>
 
+<!-- DESCRIPTION -->
+<xsl:template match="description">
+    <p id="{@id}" class="description" dir="auto"><xsl:apply-templates /></p>
+</xsl:template>
+<xsl:template match="description" mode="embedded">
+    <p id="{@id}" class="description" dir="auto"><xsl:apply-templates /></p>
+</xsl:template>
+
 <!-- In case of missing help files -->
 <xsl:template match="help-id-missing">
 <span id="bm_HID2"></span>
diff --git a/helpers/xmlhelp.dtd b/helpers/xmlhelp.dtd
index 2dba4b02b9..d033257f94 100644
--- a/helpers/xmlhelp.dtd
+++ b/helpers/xmlhelp.dtd
@@ -298,4 +298,9 @@ Version Nov 2018
   %commonAttrs;
 >
 
+<!ELEMENT description (%paraContent;)*>
+<!ATTLIST description
+  l10n CDATA #IMPLIED
+  %commonAttrs;
+>
 <!ELEMENT help-id-missing EMPTY>
commit 9deaacd83d8002f9cd53d6256a57b128c8f81836
Author:     Olivier Hallot <[email protected]>
AuthorDate: Wed Sep 17 05:11:45 2025 -0300
Commit:     Olivier Hallot <[email protected]>
CommitDate: Wed Sep 17 15:57:15 2025 +0200

    Remove duplicated code in XSLT
    
    Change-Id: I6ed9168a683f6b0a1b3a784abddf0761191ae086
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/191070
    Tested-by: Jenkins
    Reviewed-by: Olivier Hallot <[email protected]>

diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index d031d5f084..fd5862b115 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -802,33 +802,16 @@
 </xsl:template>
 
 <!--NOTE TIP AND WARNING-->
+
 <xsl:template match="tip | note | warning">
-    <xsl:variable name="imgsrc">
-        <xsl:choose>
-            <xsl:when test="local-name()='note'"><xsl:value-of 
select="$note_img"/></xsl:when>
-            <xsl:when test="local-name()='tip'"><xsl:value-of 
select="$tip_img"/></xsl:when>
-            <xsl:when test="local-name()='warning'"><xsl:value-of 
select="$warning_img"/></xsl:when>
-        </xsl:choose>
-    </xsl:variable>
-    <div class="{local-name()}">
-        <div class="noteicon" dir="auto"><img src="{$imgsrc}" 
alt="{local-name()}" style="{$iconsizestyle}"/></div>
-        <div class="notetext"><p id="{@id}" dir="auto"><xsl:apply-templates 
/></p></div>
-    </div>
-    <br/>
+    <xsl:call-template name="insertnote">
+        <xsl:with-param name="type" select="local-name()" />
+    </xsl:call-template>
 </xsl:template>
 <xsl:template match="tip | note | warning" mode="embedded">
-    <xsl:variable name="imgsrc">
-        <xsl:choose>
-            <xsl:when test="local-name()='note'"><xsl:value-of 
select="$note_img"/></xsl:when>
-            <xsl:when test="local-name()='tip'"><xsl:value-of 
select="$tip_img"/></xsl:when>
-            <xsl:when test="local-name()='warning'"><xsl:value-of 
select="$warning_img"/></xsl:when>
-        </xsl:choose>
-    </xsl:variable>
-    <div class="{local-name()}">
-        <div class="noteicon" dir="auto"><img src="{$imgsrc}" 
alt="{local-name()}" style="{$iconsizestyle}"/></div>
-        <div class="notetext"><p id="{@id}" dir="auto"><xsl:apply-templates 
mode="embedded"/></p></div>
-    </div>
-    <br/>
+    <xsl:call-template name="insertnote">
+        <xsl:with-param name="type" select="local-name()" />
+    </xsl:call-template>
 </xsl:template>
 
 <!--SQLCODE, BASCODE, PYCODE-->
@@ -858,6 +841,7 @@
         <pre dir="auto"><code class="{$codelangclass}"><xsl:apply-templates 
/></code></pre>
     </div>
 </xsl:template>
+
 <!-- In case of missing help files -->
 <xsl:template match="help-id-missing">
 <span id="bm_HID2"></span>

Reply via email to