filter/source/xslt/odf2xhtml/export/xhtml/body.xsl | 41 +++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-)
New commits: commit 9e827c4eadd951b1609107ee3772de2853e37692 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> Date: Thu Nov 30 15:37:02 2017 +0100 tdf#113696 XHTML Export: Prefer fallback graphic Which is usually png and browsers can read that, but they can't read our internal metafile format (svm) Change-Id: Idfd82da630ead69f508b74285081e32315030825 Reviewed-on: https://gerrit.libreoffice.org/45590 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> diff --git a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl index 1172e7efdbc3..9719932fcf2d 100644 --- a/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl +++ b/filter/source/xslt/odf2xhtml/export/xhtml/body.xsl @@ -1483,27 +1483,32 @@ <xsl:template match="draw:image | draw:object-ole"> <xsl:param name="globalData"/> - <xsl:choose> - <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base"> - <!-- XHTML does not allow the mapped elements to contain paragraphs --> - <xsl:call-template name="create-image-element"> - <xsl:with-param name="globalData" select="$globalData"/> - </xsl:call-template> - </xsl:when> - <xsl:otherwise> - <!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself. - A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph --> - <xsl:element name="p"> - <xsl:apply-templates select="@draw:style-name"> - <xsl:with-param name="globalData" select="$globalData"/> - </xsl:apply-templates> - + <!-- If there is a replacement graphic, we take it. + It is a png which browsers are more likely able to render than the original graphic + which might have arbitrary formats. --> + <xsl:if test="not(following-sibling::draw:image)"> + <xsl:choose> + <xsl:when test="ancestor::text:p or parent::text:span or parent::text:h or parent::draw:a or parent::text:a or text:ruby-base"> + <!-- XHTML does not allow the mapped elements to contain paragraphs --> <xsl:call-template name="create-image-element"> <xsl:with-param name="globalData" select="$globalData"/> </xsl:call-template> - </xsl:element> - </xsl:otherwise> - </xsl:choose> + </xsl:when> + <xsl:otherwise> + <!-- images are embedded in a paragraph, but are in CSS not able to express a horizontal alignment for themself. + A 'div' element taking over the image style would solve that problem, but is invalid as child of a paragraph --> + <xsl:element name="p"> + <xsl:apply-templates select="@draw:style-name"> + <xsl:with-param name="globalData" select="$globalData"/> + </xsl:apply-templates> + + <xsl:call-template name="create-image-element"> + <xsl:with-param name="globalData" select="$globalData"/> + </xsl:call-template> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:if> </xsl:template> <xsl:template name="create-image-element"> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits