From: Andrew Sayers <[email protected]>
---
Hi LibreOffice,
Earlier this year I needed to do some work with HTML document export. This
patchset represents the sundry improvements I made along the way. The code has
been stable for a while now, so I've rebased it and sent it in. I don't expect
to make any more changes at this point, Murphy notwithstanding.
Note: some of these patches deal with trailing spaces and mixed Windows/Unix
newlines. To make the patches cleanly apply, I needed to do:
git am -p0 --keep-cr patches/*
filter/source/xslt/common/measure_conversion.xsl | 48 ++++++++++++++++++++----
1 file changed, 40 insertions(+), 8 deletions(-)
diff --git filter/source/xslt/common/measure_conversion.xsl
filter/source/xslt/common/measure_conversion.xsl
index 2828f4b..f808fa3 100644
--- filter/source/xslt/common/measure_conversion.xsl
+++ filter/source/xslt/common/measure_conversion.xsl
@@ -125,8 +125,12 @@
<xsl:when test="contains($value, 'px')">
<xsl:value-of select="round($rounding-factor *
number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
</xsl:when>
+ <xsl:when test="$value = ''">
+ <xsl:message>measure_conversion.xsl: Empty
string passed for unit when when converting to to 'mm' - passing unmodified
value back</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:message>measure_conversion.xsl: Find no
conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+ <xsl:message>unrecognised value '<xsl:value-of
select="string(number($value))"/>' passed to 'convert2mm' - please update
measure_conversion.xsl to handle this unit</xsl:message>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
@@ -160,8 +164,12 @@
<xsl:when test="contains($value, 'px')">
<xsl:value-of select="round($rounding-factor *
number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm))
div $rounding-factor"/>
</xsl:when>
+ <xsl:when test="$value = ''">
+ <xsl:message>measure_conversion.xsl: Empty
string passed for unit when when converting to to 'cm' - passing unmodified
value back</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:message>measure_conversion.xsl: Find no
conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+ <xsl:message>unrecognised value '<xsl:value-of
select="string(number($value))"/>' passed to 'convert2cm' - please update
measure_conversion.xsl to handle this unit</xsl:message>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
@@ -195,8 +203,12 @@
<xsl:when test="contains($value, 'px')">
<xsl:value-of select="round($rounding-factor *
number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div
$rounding-factor"/>
</xsl:when>
+ <xsl:when test="$value = ''">
+ <xsl:message>measure_conversion.xsl: Empty
string passed for unit when when converting to to 'in' - passing unmodified
value back</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:message>measure_conversion.xsl: Find no
conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+ <xsl:message>unrecognised value '<xsl:value-of
select="string(number($value))"/>' passed to 'convert2in' - please update
measure_conversion.xsl to handle this unit</xsl:message>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
@@ -230,8 +242,12 @@
<xsl:when test="contains($value, 'px')">
<xsl:value-of select="round($rounding-factor *
number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm))
div $rounding-factor"/>
</xsl:when>
+ <xsl:when test="$value = ''">
+ <xsl:message>measure_conversion.xsl: Empty
string passed for unit when when converting to to 'dpt' - passing unmodified
value back</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:message>measure_conversion.xsl: Find no
conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+ <xsl:message>unrecognised value '<xsl:value-of
select="string(number($value))"/>' passed to 'convert2dpt' - please update
measure_conversion.xsl to handle this unit</xsl:message>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
@@ -265,8 +281,12 @@
<xsl:when test="contains($value, 'px')">
<xsl:value-of select="round($rounding-factor *
number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div
$rounding-factor"/>
</xsl:when>
+ <xsl:when test="$value = ''">
+ <xsl:message>measure_conversion.xsl: Empty
string passed for unit when when converting to to 'pica' - passing unmodified
value back</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:message>measure_conversion.xsl: Find no
conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+ <xsl:message>unrecognised value '<xsl:value-of
select="string(number($value))"/>' passed to 'convert2pica' - please update
measure_conversion.xsl to handle this unit</xsl:message>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
@@ -300,8 +320,12 @@
<xsl:when test="contains($value, 'px')">
<xsl:value-of select="round($rounding-factor *
number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div
$rounding-factor"/>
</xsl:when>
+ <xsl:when test="$value = ''">
+ <xsl:message>measure_conversion.xsl: Empty
string passed for unit when when converting to to 'pt' - passing unmodified
value back</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:message>measure_conversion.xsl: Find no
conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+ <xsl:message>unrecognised value '<xsl:value-of
select="string(number($value))"/>' passed to 'convert2pt' - please update
measure_conversion.xsl to handle this unit</xsl:message>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
@@ -335,8 +359,12 @@
<xsl:when test="contains($value, 'px')">
<xsl:value-of select="round($rounding-factor *
number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div
$rounding-factor"/>
</xsl:when>
+ <xsl:when test="$value = ''">
+ <xsl:message>measure_conversion.xsl: Empty
string passed for unit when when converting to to 'wip' - passing unmodified
value back</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:message>measure_conversion.xsl: Find no
conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+ <xsl:message>unrecognised value '<xsl:value-of
select="string(number($value))"/>' passed to 'convert2twip' - please update
measure_conversion.xsl to handle this unit</xsl:message>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
@@ -369,8 +397,12 @@
<xsl:when test="contains($value, 'px')">
<xsl:value-of select="$value"/>
</xsl:when>
+ <xsl:when test="$value = ''">
+ <xsl:message>measure_conversion.xsl: Empty
string passed for unit when when converting to to 'px' - passing unmodified
value back</xsl:message>
+ <xsl:value-of select="$value"/>
+ </xsl:when>
<xsl:otherwise>
- <xsl:message>measure_conversion.xsl: Find no
conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+ <xsl:message>unrecognised value '<xsl:value-of
select="string(number($value))"/>' passed to 'convert2px' - please update
measure_conversion.xsl to handle this unit</xsl:message>
<xsl:value-of select="$value"/>
</xsl:otherwise>
</xsl:choose>
--
1.8.5.1
_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice