Commit e099624e authored by Eva Huet's avatar Eva Huet
Browse files

JATS : fix équations

parent f9d91f60
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -1344,11 +1344,30 @@
    <xsl:template match="tex-math">
        <xsl:choose>
            <xsl:when test="ancestor::inline-formula">
                <xsl:choose>
                    <xsl:when test="starts-with(node(), '$') and substring(node(), string-length(node()), 1) = '$'">
                        <xsl:copy-of select="concat('\(', substring(node(), 2, string-length(node()) - 2), '\)')"/>
                    </xsl:when>
                    <xsl:when test="starts-with(node(), '\(') and substring(node(), string-length(node()) - 1, 2) = '\)'">
                        <xsl:copy-of select="."/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:copy-of select="concat('\(',node(),'\)')"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:when> 
            <xsl:otherwise>
                    <xsl:copy-of select="@*"/>
                    <xsl:copy-of select="concat('$$',node(),'$$')"/>
                <xsl:choose>
                    <xsl:when test="starts-with(node(), '$$') and substring(node(), string-length(node()) - 1, 2) = '$$'">
                        <xsl:copy-of select="concat('\[', substring(node(), 3, string-length(node()) - 4), '\]')"/>
                    </xsl:when>
                    <xsl:when test="starts-with(node(), '\[') and substring(node(), string-length(node()) - 1, 2) = '\]'">
                        <xsl:copy-of select="."/>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:copy-of select="concat('\[',node(),'\]')"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>