Commit c0f88010 authored by Alex Theg's avatar Alex Theg
Browse files

Merge branch 'track-changes' into 'master'

Track changes to inline formatting

See merge request !5
parents a94356f6 d27adb04
......@@ -666,7 +666,7 @@
<xsl:template mode="build-properties" as="element(xsw:prop)*" match="w:color">
<xsl:if test="not(@w:val='000000')">
<xsw:prop name="color">
<xsl:value-of select="@w:val/replace(., '^\d', '#$0')"/>
<xsl:value-of select="concat('#', @w:val)"/>
</xsw:prop>
</xsl:if>
</xsl:template>
......@@ -811,4 +811,65 @@
</xsl:element>
</xsl:template>
<xsl:template match="w:rPrChange" priority="20">
<track-change>
<xsl:attribute name="id" select="string-join(('tc',./@w:id),'-')" />
<xsl:attribute name="data-author" select="./@w:author" />
<xsl:attribute name="datetime" select="@w:date"/>
<xsl:if test="(count(./parent::node()/child::*) &gt; 1)">
<xsl:attribute name="data-addedtype">
<xsl:value-of select="xsw:tcFormatValues(./parent::node()/child::*)"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="(count(./w:rPr/*) &gt; 0)">
<xsl:attribute name="data-oldtype">
<xsl:value-of select="xsw:tcFormatValues(./w:rPr/*)"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="./ancestor-or-self::w:r/w:t" />
</track-change>
</xsl:template>
<xsl:function name="xsw:tcFormatValues">
<xsl:param name="tc-path" />
<xsl:for-each select="$tc-path">
<xsl:if test="name() = 'w:b'">
<xsl:text>font-weight: bold;</xsl:text>
</xsl:if>
<xsl:if test="name() = 'w:i'">
<xsl:text>font-style: italic;</xsl:text>
</xsl:if>
<xsl:if test="name() = 'w:caps'">
<xsl:text>text-transform: uppercase;</xsl:text>
</xsl:if>
<xsl:if test="name() = 'w:strike'">
<xsl:text>text-decoration: line-through;</xsl:text>
</xsl:if>
<xsl:if test="name() = 'w:dstrike'">
<xsl:text>text-decoration: line-through; text-decoration-style: double;</xsl:text>
</xsl:if>
<xsl:if test="name() = 'w:smallCaps'">
<xsl:text>font-variant: small-caps;</xsl:text>
</xsl:if>
<xsl:if test="name() = 'w:color'">
<xsl:text>color: </xsl:text><xsl:value-of select="concat('#', @w:val)"/><xsl:text>;</xsl:text>
</xsl:if>
<xsl:if test="name() = 'w:sz'">
<xsl:text>font-size: </xsl:text><xsl:value-of select="@w:val div 2"/><xsl:text>pt;</xsl:text>
</xsl:if>
<xsl:if test="name() = 'w:u'">
<xsl:text>font-style: underline;</xsl:text>
</xsl:if>
<xsl:if test="(name() = 'w:vertAlign') and (@w:val = 'subscript')">
<xsl:text>vertical-align: sub;</xsl:text>
</xsl:if>
<xsl:if test="(name() = 'w:vertAlign') and (@w:val = 'superscript')">
<xsl:text>vertical-align: super;</xsl:text>
</xsl:if>
<xsl:if test="(name() = 'w:highlight')">
<xsl:text>background-color: </xsl:text><xsl:value-of select="@w:val"/><xsl:text>;</xsl:text>
</xsl:if>
</xsl:for-each>
</xsl:function>
</xsl:stylesheet>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment