help3xsl/default.css                             |   27 ++++++++++++++++++++++
 help3xsl/online_transform.xsl                    |    7 ++++-
 helpers/xmlhelp.dtd                              |    7 ++++-
 source/text/sbasic/shared/03/lib_ScriptForge.xhp |   28 +++++++++--------------
 4 files changed, 50 insertions(+), 19 deletions(-)

New commits:
commit 5bab8a2d2530d7487064a2560c440269018a56b9
Author:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
AuthorDate: Mon Apr 18 12:41:48 2022 +0300
Commit:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
CommitDate: Tue Apr 19 14:51:33 2022 +0200

    tdf#148621 Make ScriptForge service tables mobile-friendly
    
    - Introduce <tablehead> element
    - While considering text-align, I noticed we do not take RTL languages
    into account. A CSS rule 'html[dir=ltr] th' was added, which does
    nothing at the moment. We should look into directionality.
    
    Change-Id: Ib59aa0c508529c0beaa35542d96bd5cc1aa4db29
    Reviewed-on: https://gerrit.libreoffice.org/c/help/+/133114
    Tested-by: Jenkins
    Reviewed-by: Olivier Hallot <olivier.hal...@libreoffice.org>

diff --git a/help3xsl/default.css b/help3xsl/default.css
index 2c5e59ac0..bc053cc70 100644
--- a/help3xsl/default.css
+++ b/help3xsl/default.css
@@ -212,6 +212,9 @@ table, th, td {
     border-right: 0;
     padding: 0.3em;
 }
+html[dir=ltr] th {
+    text-align: left;
+}
 .tablehead,
 .tableheadintable {
     font-weight: bold;
@@ -226,6 +229,17 @@ table, th, td {
     font-size: 0.98rem;
 }
 
+/* ScriptForge service tables */
+.sf_table {
+    min-width: 100%;
+}
+.sf_table thead {
+    display: none;
+}
+.sf_table tr, .sf_table td {
+    display: block;
+}
+
 h1,
 h2,
 h3,
@@ -840,6 +854,19 @@ li.disabled a {
         max-width: 200px;
         width: 100%
     }
+    /* ScriptForge service tables */
+    .sf_table {
+        min-width: auto;
+    }
+    .sf_table thead {
+        display: table-header-group;
+    }
+    .sf_table tr {
+        display: table-row;
+    }
+    .sf_table td {
+        display: table-cell;
+    }
 }
 @media screen and (min-width: 1440px) {
     #Contents {
diff --git a/help3xsl/online_transform.xsl b/help3xsl/online_transform.xsl
index 465415ea2..70c7ab0af 100644
--- a/help3xsl/online_transform.xsl
+++ b/help3xsl/online_transform.xsl
@@ -732,7 +732,7 @@
 <xsl:template match="tablecell">
     <xsl:choose>
         <xsl:when test="paragraph[@role='tablehead']">
-            <td rowspan="{@rowspan}" colspan="{@colspan}" 
class='tableheadcell'><xsl:apply-templates /></td>
+            <th rowspan="{@rowspan}" colspan="{@colspan}" 
class='tableheadcell'><xsl:apply-templates /></th>
         </xsl:when>
         <xsl:otherwise>
             <td rowspan="{@rowspan}" colspan="{@colspan}"><xsl:apply-templates 
/></td>
@@ -744,7 +744,7 @@
 <xsl:template match="tablecell" mode="embedded">
     <xsl:choose>
         <xsl:when test="paragraph[@role='tablehead']">
-            <td rowspan="{@rowspan}" colspan="{@colspan}" 
class='tableheadcell'><xsl:apply-templates mode="embedded"/></td>
+            <th rowspan="{@rowspan}" colspan="{@colspan}" 
class='tableheadcell'><xsl:apply-templates mode="embedded"/></th>
         </xsl:when>
         <xsl:otherwise>
             <td rowspan="{@rowspan}" colspan="{@colspan}"><xsl:apply-templates 
mode="embedded"/></td>
@@ -758,6 +758,9 @@
 <xsl:template match="tablerow" mode="icontable"><div 
class="icontable"><xsl:apply-templates mode="icontable"/></div></xsl:template>
 <xsl:template match="tablerow" mode="embedded"><tr><xsl:apply-templates 
mode="embedded"/></tr></xsl:template>
 
+<!-- TABLEHEAD -->
+<xsl:template match="tablehead"><thead><xsl:apply-templates 
/></thead></xsl:template>
+
 <!-- TITLE -->
 <xsl:template match="title"/>
 
diff --git a/helpers/xmlhelp.dtd b/helpers/xmlhelp.dtd
index 6a4ef9778..fcb1076b5 100644
--- a/helpers/xmlhelp.dtd
+++ b/helpers/xmlhelp.dtd
@@ -228,7 +228,7 @@ Version Nov 2018
   select (sys | appl | distrib | target | ver | lang) #REQUIRED
 >
 
-<!ELEMENT table (caption*, tablerow+)>
+<!ELEMENT table (caption*, tablehead*, tablerow+)>
 <!ATTLIST table
   name CDATA #IMPLIED
   width CDATA #IMPLIED
@@ -254,6 +254,11 @@ Version Nov 2018
   unit CDATA #IMPLIED
 >
 
+<!ELEMENT tablehead (tablerow+)>
+<!ATTLIST tablehead
+  class CDATA #IMPLIED
+>
+
 <!ELEMENT title (#PCDATA)>
 <!ATTLIST title
   xml-lang CDATA #IMPLIED
diff --git a/source/text/sbasic/shared/03/lib_ScriptForge.xhp 
b/source/text/sbasic/shared/03/lib_ScriptForge.xhp
index 3dccd6a3c..8c1dee32a 100644
--- a/source/text/sbasic/shared/03/lib_ScriptForge.xhp
+++ b/source/text/sbasic/shared/03/lib_ScriptForge.xhp
@@ -51,21 +51,17 @@
   </pycode>
 
   <h2 id="hd_id851613836643580">Services provided by the ScriptForge 
library</h2>
-  <table id="tab_id311613838858931">
-    <tablerow>
-       <tablecell>
-         <paragraph id="par_id131613838858931" 
role="tablehead">Category</paragraph>
-       </tablecell>
-       <tablecell>
-         <paragraph id="par_id441613838858931" 
role="tablehead">Services</paragraph>
-       </tablecell>
-       <tablecell>
-         <paragraph id="par_id441613839128931" localize="false" 
role="tablehead"></paragraph>
-       </tablecell>
-       <tablecell>
-         <paragraph id="par_id441613839128041" localize="false" 
role="tablehead"></paragraph>
-       </tablecell>
-    </tablerow>
+  <table id="tab_id311613838858931" class="sf_table">
+    <tablehead>
+      <tablerow>
+        <tablecell>
+          <paragraph id="par_id131613838858931" 
role="tablehead">Category</paragraph>
+        </tablecell>
+        <tablecell colspan="3">
+          <paragraph id="par_id441613838858931" 
role="tablehead">Services</paragraph>
+        </tablecell>
+      </tablerow>
+    </tablehead>
     <tablerow>
        <tablecell>
          <paragraph id="par_id851613847558931" 
role="tablecontent">%PRODUCTNAME Basic</paragraph>
@@ -241,4 +237,4 @@
       <warning id="par_id851506659675843">All <literal>ScriptForge</literal> 
Basic routines or identifiers that are prefixed with an underscore character 
"_" are reserved for internal use. They are not meant be used in Basic macros 
or Python scripts.</warning>
     </section>
 </body>
-</helpdocument>
\ No newline at end of file
+</helpdocument>

Reply via email to