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

Frédéric Wang fred.wang at free.fr
Tue Jul 9 02:03:38 PDT 2013


 filter/source/xslt/odf2xhtml/export/xhtml/body.xsl |   22 ++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

New commits:
commit fb2edd686c8b8ba4318e957f7cf23060ffd3e2c3
Author: Frédéric Wang <fred.wang at free.fr>
Date:   Sat Jul 6 15:57:42 2013 +0200

      fdo#66645 XHTML export: ignore incorrect style on math objects
    
    Change-Id: Ied09a189184380aa3eba30261c7517f6bccf6d09
    Reviewed-on: https://gerrit.libreoffice.org/4751
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>
    Tested-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
index e83195c..2dada31 100644
--- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
+++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl
@@ -1068,6 +1068,23 @@
 			<xsl:value-of select="$elem-name"/>' is a draw:frame.
 		</xsl:comment>
 		<xsl:element name="{$elem-name}">
+		  <xsl:choose>
+		    <xsl:when test="draw:object/math:math">
+		      <!-- draw:frame elements contain many data that are not
+			   relevant for mathematical formulas and that may
+			   cause incorrect rendering. Let's ignore the
+			   replacement image and keep only the id attribute.
+			   See fdo#66645 -->
+		      <xsl:apply-templates select="@draw:name"/>
+		      <xsl:text> </xsl:text>
+		      <xsl:apply-templates select="draw:object[1]"/>
+		      <!-- TODO: do not always add a space after the formula,
+			   for example when it is followed by a comma, period,
+			   dash etc This will probably require using regexp
+			   features like xsl:analyze-string -->
+		      <xsl:text> </xsl:text>
+		    </xsl:when>
+		    <xsl:otherwise>
 			<xsl:attribute name="style">
 				<xsl:call-template name="widthAndHeight"/>
 				<xsl:text> padding:0; </xsl:text>
@@ -1090,6 +1107,8 @@
 			<xsl:apply-templates select="node()">
 				<xsl:with-param name="globalData" select="$globalData"/>
 			</xsl:apply-templates>
+		    </xsl:otherwise>
+		  </xsl:choose>
 		</xsl:element>
 	</xsl:template>
 
@@ -2969,7 +2988,4 @@
 		<xsl:apply-templates select="*[1]" mode="math"/>
 	</xsl:template>
 
-	<!-- Ignore the replacement image -->
-	<xsl:template match="draw:frame/draw:image[preceding-sibling::*[1]/math:math]"/>
-
 </xsl:stylesheet>


More information about the Libreoffice-commits mailing list