summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklin Weng <franklin@goodhorse.idv.tw>2023-03-22 12:33:38 +0800
committerIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2023-04-21 11:35:16 +0200
commitce4272c25426f0084e53735e80870b9339239078 (patch)
tree6a08a731633f29ea5c606d046c43561ecb5f80be
parent593130b0df424a40983b67ce3224dbb40a69556e (diff)
tdf#153839 : Further handling for adding newlines
before and after some tags as described in comment 7 Change-Id: I6e2a6559a888d259c6d1cc848fad7d39a1ab653b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149280 Reviewed-by: Stéphane Guillou <stephane.guillou@libreoffice.org> Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
-rw-r--r--filter/source/xslt/odf2xhtml/export/common/table/table.xsl4
-rw-r--r--filter/source/xslt/odf2xhtml/export/xhtml/body.xsl19
2 files changed, 20 insertions, 3 deletions
diff --git a/filter/source/xslt/odf2xhtml/export/common/table/table.xsl b/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
index cfc1ebbc525b..d55948cab5b9 100644
--- a/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
+++ b/filter/source/xslt/odf2xhtml/export/common/table/table.xsl
@@ -63,6 +63,7 @@
<xsl:template match="table:table" name="table:table">
+ <xsl:text>&#xa;</xsl:text>
<xsl:param name="globalData" />
<!-- The table will only be created if the table:scenario is active -->
@@ -71,6 +72,7 @@
<xsl:with-param name="globalData" select="$globalData" />
</xsl:call-template>
</xsl:if>
+ <xsl:text>&#xa;</xsl:text>
</xsl:template>
@@ -110,10 +112,12 @@
</xsl:element>
</xsl:when>
<xsl:otherwise>
+ <xsl:text>&#xa;</xsl:text>
<xsl:call-template name="create-table-element">
<xsl:with-param name="globalData" select="$globalData" />
<xsl:with-param name="allVisibleTableRows" select="$allVisibleTableRows" />
</xsl:call-template>
+ <xsl:text>&#xa;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index ca7a6906b82c..fca8d9a763b7 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -248,7 +248,9 @@
<xsl:template match="draw:text-box">
<xsl:param name="globalData"/>
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' was a 'draw:text-box'.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="div">
<xsl:variable name="dimension">
<xsl:apply-templates select="@fo:min-width"/>
@@ -372,10 +374,14 @@
<!-- The paragraph is written as DIV as there might be nested paragraphs (see above choose block) -->
<xsl:choose>
<xsl:when test="name() = 'text:p'">
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' was a 'text:p'.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
</xsl:when>
<xsl:otherwise>
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' was a 'draw:page'.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:element name="div">
@@ -829,7 +835,9 @@
<!-- every following frame sibling till the next draw:frame
have to be encapsulated within a div with left indent.
To be moved altogether according the indent (usually right) -->
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' added for floating.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="div">
<xsl:attribute name="style">
<xsl:text>display:inline; position:relative; left:</xsl:text>
@@ -1020,7 +1028,9 @@
</xsl:variable>
<!-- if the frame is anchored on a paragraph -->
<xsl:if test="@text:anchor-type='paragraph'">
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' is emulating the top height of a draw:frame.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<!-- When the svg:y is set relative to the paragraph content, the best way to emulate a positive height,
is to add an invisible division inbetween with a height.
Often text will flow into this 'gap', which is handled separately!
@@ -1066,9 +1076,9 @@
<xsl:otherwise>div</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <xsl:comment>Next '
- <xsl:value-of select="$elem-name"/>' is a draw:frame.
- </xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
+ <xsl:comment>Next '<xsl:value-of select="$elem-name"/>' is a draw:frame. </xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="{$elem-name}">
<xsl:choose>
<xsl:when test="draw:object/math:math">
@@ -2793,12 +2803,15 @@
<xsl:param name="globalData"/>
<xsl:if test="not(contains(@text:display, 'none'))">
+ <xsl:text>&#xa;</xsl:text>
<xsl:comment>Next 'div' was a 'text:section'.</xsl:comment>
+ <xsl:text>&#xa;</xsl:text>
<xsl:element name="div">
<xsl:call-template name="apply-styles-and-content">
<xsl:with-param name="globalData" select="$globalData"/>
</xsl:call-template>
</xsl:element>
+ <xsl:text>&#xa;</xsl:text>
</xsl:if>
</xsl:template>