filter/source/xslt/odf2xhtml/export/xhtml/body.xsl |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 984f0e49d35ba87c105310f27d945147a23d1198
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Fri Nov 8 11:41:28 2024 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Wed Nov 13 10:41:34 2024 +0100

    tdf#163874 sw inline heading: fix XHTML export
    
    Text frames anchored as characters, containing inline
    headings were exported without display:inline using
    the XSLT XHTML filter (see File->Export As), resulting
    separated paragraphs for inline headings.
    
    Note: both div and heading elements need display:inline.
    
    This reverts commit d2e8705c9cc503afdaed366b1f71ed012b0c568f
    "tdf#153839: add newline after certain tags" partially
    (and conditionally), because fancy printing is bad here:
    the new line between the div element was converted to a space
    at display:inline, resulting double space with the original
    space between the inline heading and the other text content
    of the following part of the paragraph line.
    
    Follow-up to commit 7a35f3dc7419d833b8f47069c4df63e900ccb880
    "tdf#48459 sw inline heading: apply it on the selected words",
    commit d87cf67f8f3346a1e380383917a3a4552fd9248e
    "tdf#131728 sw inline heading: fix missing/broken DOCX export"
    and commit a1dcbd1d1ce6071d48bb5df26d7839aeb21b75a8
    "tdf48459 sw inline heading: add Inline Heading frame style".
    
    Change-Id: I6623066354a70a69faf14cd30fc2b917c9ec9c90
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176511
    Reviewed-by: László Németh <nem...@numbertext.org>
    Tested-by: Jenkins

diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl 
b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index a8a4aa0b0347..d28ed42dcbd9 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -264,9 +264,13 @@
                 <xsl:apply-templates select="@fo:min-height" />
                 <xsl:apply-templates select="@fo:max-height" />
             </xsl:variable>
+            <!-- inline heading -->
+            <xsl:variable name="inlineHeading">
+                <xsl:if 
test="parent::draw:frame/@text:anchor-type='as-char'">display:inline;</xsl:if>
+            </xsl:variable>
             <xsl:if test="normalize-space($dimension)!=''">
                 <xsl:attribute name="style">
-                    <xsl:value-of select="$dimension" />
+                    <xsl:value-of select="concat($dimension,$inlineHeading)" />
                 </xsl:attribute>
             </xsl:if>
 
@@ -1213,6 +1217,13 @@
                 </xsl:call-template>
             </xsl:attribute>
 
+            <!-- inline heading -->
+            <xsl:if test="parent::draw:text-box and 
../../@text:anchor-type='as-char'">
+                <xsl:attribute name="style">
+                    <xsl:text>display:inline;</xsl:text>
+                </xsl:attribute>
+            </xsl:if>
+
             <xsl:call-template name="create-heading-anchor">
                 <xsl:with-param name="globalData" select="$globalData"/>
             </xsl:call-template>
@@ -1222,7 +1233,10 @@
             </xsl:apply-templates>
         </xsl:element>
 
-        <xsl:text>&#xa;</xsl:text>
+        <!-- add new line, except for inline headings to avoid of double 
spaces -->
+        <xsl:if test="not(parent::draw:text-box and 
../../@text:anchor-type='as-char')">
+            <xsl:text>&#xa;</xsl:text>
+        </xsl:if>
     </xsl:template>
 
     <xsl:template name="create-heading-anchor">

Reply via email to