[Libreoffice-commits] core.git: 2 commits - filter/source

Svante Schubert (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 2 12:24:10 UTC 2021


 filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl |   62 +++++-----
 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl                    |   44 +++++--
 2 files changed, 66 insertions(+), 40 deletions(-)

New commits:
commit fbe545c4eeb48ec847f48afa9573d0514fc51f63
Author:     Svante Schubert <svante.schubert at gmail.com>
AuthorDate: Wed Aug 26 13:50:10 2020 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Mar 2 13:23:33 2021 +0100

    HTML XSLT: Appendix headings looked incorrect (in general heading within lists were missing HTML element heading number)
    
    Change-Id: I125b095a436be3c6d9f5f64496564d63ea10a5fb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111618
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 53af56fa2f94..b3276a4ba358 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -2623,7 +2623,8 @@
         <xsl:param name="listStyleName"/>
         <xsl:param name="minLabelWidth"/>
 
-        <xsl:element name="h">
+        <xsl:variable name="headingName" select="concat('h', $listLevel - 1)"/>
+        <xsl:element name="{$headingName}">
             <xsl:call-template name="create-list-style">
                 <xsl:with-param name="globalData" select="$globalData"/>
                 <xsl:with-param name="listIndent" select="$listIndent"/>
commit 9d3b39cf9fed9a305ac23d1ecaaafc8f7caaeeb0
Author:     Svante Schubert <svante.schubert at gmail.com>
AuthorDate: Wed Aug 26 13:44:57 2020 +0200
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Mar 2 13:23:17 2021 +0100

    HTML XSLT: Missing paragraph BORDER of stand-alone border paragraph (@style:join-border problem)
    
    Change-Id: I20afce950213d4d55541d66a438db14a54b6ddd1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111617
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>

diff --git a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
index d1c8f189be85..389be7da5638 100644
--- a/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/styles/style_collector.xsl
@@ -514,9 +514,17 @@
                 <xsl:copy-of select="." />
             </xsl:for-each>
 
+            <!-- split border into border parts for better activation-check on style:joint-border feature -->
+            <xsl:if test="*/@fo:border">
+                <xsl:attribute name="fo:border-top" select="*/@fo:border" />
+                <xsl:attribute name="fo:border-left" select="*/@fo:border" />
+                <xsl:attribute name="fo:border-bottom" select="*/@fo:border" />
+                <xsl:attribute name="fo:border-right" select="*/@fo:border" />
+            </xsl:if>
+
            <!--All current attributes will override already inserted attributes of the same name
                XSLT Spec: "Adding an attribute to an element replaces any existing attribute of that element with the same expanded-name." -->
-            <xsl:for-each select="*/@*[name() != 'style:font-size-rel']">
+            <xsl:for-each select="*/@*[name() != 'style:font-size-rel'][name() != 'fo:border']">
                 <xsl:copy-of select="." />
             </xsl:for-each>
 
@@ -702,40 +710,28 @@
     <xsl:template name="writeUsedStyles2">
         <xsl:param name="globalData" />
         <xsl:param name="style"/>
+        <!-- activation-check on style:joint-border feature -->
         <xsl:choose>
             <xsl:when test="
                 $style/@style:family='paragraph'
                 and
-            (
-                (
                     (
                         $style/*/@fo:border-top
-                        or $style/*/@fo:border-bottom
-                        or ($style/*/@fo:border
-                        and
-                        not($style/*/@fo:border='none')
-                        )
+                        or
+                        $style/*/@fo:border-bottom
                     )
-                    and
-                    (
-                        not($style/*/@style:join-border)
-                        or  $style/*/@style:join-border = 'true'
-                    )
-                )
-                or
-                (
+                and
                     (
-                        $style/*/@fo:margin-top
-                        or $style/*/@fo:margin-bottom
-                        or $style/*/@fo:margin
+                        not($style/*/@fo:border-top='none' and
+                            $style/*/@fo:border-left='none' and
+                            $style/*/@fo:border-right='none' and
+                            $style/*/@fo:border-bottom='none')
                     )
-                    and
-                    (     $style/*/@fo:background-color
-                    and
-                        not($style/*/@fo:background-color='transparent')
-                    )
-                )
-            )">
+                and
+                   (
+                         not($style/*/@style:join-border)
+                    or  $style/*/@style:join-border = 'true'
+                   )">
                 <xsl:element name="style" namespace="">
                     <xsl:copy-of select="$style/@style:family" />
                     <xsl:attribute name="style:name"><xsl:value-of select="concat($style/@style:name, '_borderStart')" /></xsl:attribute>
@@ -751,8 +747,7 @@
                 </xsl:element>
                 <xsl:element name="style" namespace="">
                     <xsl:copy-of select="$style/@style:family" />
-                    <xsl:copy-of select="$style/@style:name" />
-                    <xsl:attribute name="mergedBorders"><xsl:value-of select="true()" /></xsl:attribute>
+                    <xsl:attribute name="style:name"><xsl:value-of select="concat($style/@style:name, '_borderSides')" /></xsl:attribute>
                     <xsl:element name="final-properties" namespace="">
                         <xsl:apply-templates select="$style/*/@*[not(name() = 'fo:border-top') and not(name() = 'fo:border-bottom')][not(name() = 'fo:padding-top') and not(name() = 'fo:padding-bottom')][not(name() = 'fo:margin-top') and not(name() = 'fo:margin-bottom')][not(name() = 'fo:margin')]">
                             <xsl:with-param name="globalData" select="$globalData" />
@@ -776,6 +771,17 @@
                         <xsl:text> border-top-style:none;</xsl:text>
                     </xsl:element>
                 </xsl:element>
+                <xsl:element name="style" namespace="">
+                    <xsl:copy-of select="$style/@style:family" />
+                    <xsl:copy-of select="$style/@style:name" />
+                    <!-- the original name bears the trigger: 'mergedBorder' flag-->
+                    <xsl:attribute name="mergedBorders"><xsl:value-of select="true()" /></xsl:attribute>
+                    <xsl:element name="final-properties" namespace="">
+                        <xsl:apply-templates select="$style/*/@*">
+                            <xsl:with-param name="globalData" select="$globalData" />
+                        </xsl:apply-templates>
+                    </xsl:element>
+                </xsl:element>
             </xsl:when>
             <xsl:otherwise>
                 <xsl:choose>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index 62a2cf613b19..53af56fa2f94 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -704,13 +704,19 @@
                                         <xsl:with-param name="globalData" select="$globalData"/>
                                     </xsl:apply-templates>
                                 </xsl:when>
-                                <xsl:otherwise>
+                                <!-- inbetween paragraphs with border/margin -->
+                                <xsl:when test="$isPrecedingBorderParagraph and $isFollowingBorderParagraph">
                                     <xsl:attribute name="class">
-                                        <xsl:value-of select="translate(@text:style-name, '.,;: %()[]/\+', '_____________')"/>
+                                        <xsl:value-of select="concat(translate(@text:style-name, '.,;: %()[]/\+', '_____________'), '_borderSides')"/>
                                     </xsl:attribute>
                                     <xsl:apply-templates>
                                         <xsl:with-param name="globalData" select="$globalData"/>
                                     </xsl:apply-templates>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:call-template name="write-paragraph">
+                                        <xsl:with-param name="globalData" select="$globalData"/>
+                                    </xsl:call-template>
                                 </xsl:otherwise>
                             </xsl:choose>
                         </xsl:when>
@@ -1610,14 +1616,27 @@
         ============
 
         The indent of a list label is not only calculated by using the text:space-before of the list level (listLevelStyle), but
-        as well taking the left margin of the first paragraph (or heading) of the list into account as loy match="" name="" use=""/>ng it is not negative.
-
-        |           MARGIN LEFT                 |        LABEL           |
-
-        |   text:space-before (listlevelstyle)  | text:min-label-width   |
-        | + fo:left-margin (firstParagraph)     |                        |
-
-        Further details beyond text:list-list...
+        as well taking the left margin of the first paragraph (or heading) of the list into account as long it is not negative.
+
+        |           MARGIN LEFT                  |                    LABEL                     |        CONTENT-PADDING
+            @text:space-before (1)               |            @text:min-label-width (1)         |  @text:min-label-distance (1)
+        | + @fo:left-margin (firstParagraph)     |                                              |
+
+
+        (1) all attributes belong to: text:list-style/$listLevelStyle/style:list-level-properties/@*
+            $listLevelStyle might be one of three choices:
+                1) <text:list-level-style-number>
+                2) <text:list-level-style-bullet>
+                3) <text:list-level-style-image>
+
+    For example:
+    <text:list-style style:name="Appendix">
+        <text:list-level-style-number text:level="1" text:style-name="Zeichenformat" style:num-prefix="Appendix " style:num-suffix=". " style:num-format="A" style:num-letter-sync="true">
+            <style:list-level-properties text:min-label-width="0.762cm" text:min-label-distance="0.127cm"/>
+        </text:list-level-style-number>
+        <text:list-level-style-number text:level="2" text:style-name="Zeichenformat" style:num-suffix="." style:num-format="1" text:display-levels="2">
+             <style:list-level-properties text:min-label-width="1.016cm"/>
+        </text:list-level-style-number>
     -->
     <xsl:key name="listStyles" match=" /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style | /*/office:styles/text:list-style | /*/office:automatic-styles/text:list-style | /*/office:styles/style:graphic-properties/text:list-style | /*/office:automatic-styles/style:graphic-properties/text:list-style" use="@style:name"/>
 
@@ -2004,7 +2023,7 @@
                                 <xsl:otherwise>
                                     <xsl:variable name="listLabelWidth">
                                         <xsl:choose>
-                                            <xsl:when test="$minLabelWidth > $minLabelDist">
+                                            <xsl:when test="$minLabelWidth">
                                                 <xsl:value-of select="$minLabelWidth"/>
                                             </xsl:when>
                                             <xsl:otherwise>


More information about the Libreoffice-commits mailing list