Fix handling of colors in hex format

This commit is contained in:
Nathan Gray 2011-08-09 19:39:24 +00:00
parent e15b7304bc
commit 1c2486e058
2 changed files with 22 additions and 9 deletions

View File

@ -150,12 +150,11 @@ Breakers
<xsl:choose>
<xsl:when test="contains(., 'rgb(')">
<xsl:call-template name="rbga-to-hex">
<xsl:with-param name="rgba-val" select="."/>
<xsl:with-param name="rgba-val" select="substring-after(.,':')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<!-- This is not quite right -->
<xsl:variable name="hex" select="." />
<xsl:value-of select="substring-after(.,'#')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
@ -163,9 +162,16 @@ Breakers
</xsl:if>
<xsl:if test="starts-with(.,'background-color:')">
<xsl:variable name="hex">
<xsl:call-template name="rbga-to-hex">
<xsl:with-param name="rgba-val" select="."/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="contains(., 'rgb(')">
<xsl:call-template name="rbga-to-hex">
<xsl:with-param name="rgba-val" select="substring-after(.,':')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-after(.,'#')" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<w:shd w:fill="{$hex}"/>
</xsl:if>

View File

@ -167,9 +167,16 @@
<xsl:choose>
<xsl:when test="starts-with(.,'color:')">
<xsl:variable name="hex">
<xsl:call-template name="rbga-to-hex">
<xsl:with-param name="rgba-val" select="substring-after(.,':')"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="contains(., 'rgb(')">
<xsl:call-template name="rbga-to-hex">
<xsl:with-param name="rgba-val" select="substring-after(.,':')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-after(.,'#')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<style:text-properties fo:color="#{$hex}"/>
</xsl:when>