Skip to content

Commit

Permalink
Merge pull request #173 from metanorma/feature/xslt-update
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jun 30, 2023
2 parents 4f0bbac + b83ae3b commit 46792fb
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/isodoc/m3aawg/m3aawg.policy.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6081,6 +6081,27 @@
</xsl:copy>
</xsl:template>

<!-- increase space before '(' -->
<xsl:template match="mathml:mo[normalize-space(text()) = '(']" mode="mathml">
<xsl:copy>
<xsl:apply-templates select="@*" mode="mathml"/>
<xsl:if test="(preceding-sibling::* and not(preceding-sibling::*[1][self::mathml:mo])) or (../preceding-sibling::* and not(../preceding-sibling::*[1][self::mathml:mo]))">
<xsl:if test="not(@lspace)">
<xsl:attribute name="lspace">0.4em</xsl:attribute>
<xsl:choose>
<xsl:when test="preceding-sibling::*[1][self::mathml:mi or self::mathml:mstyle]">
<xsl:attribute name="lspace">0.2em</xsl:attribute>
</xsl:when>
<xsl:when test="../preceding-sibling::*[1][self::mathml:mi or self::mathml:mstyle]">
<xsl:attribute name="lspace">0.2em</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:if>
<xsl:apply-templates mode="mathml"/>
</xsl:copy>
</xsl:template>

<!-- Examples:
<stem type="AsciiMath">x = 1</stem>
<stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
Expand Down
21 changes: 21 additions & 0 deletions lib/isodoc/m3aawg/m3aawg.report.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -6081,6 +6081,27 @@
</xsl:copy>
</xsl:template>

<!-- increase space before '(' -->
<xsl:template match="mathml:mo[normalize-space(text()) = '(']" mode="mathml">
<xsl:copy>
<xsl:apply-templates select="@*" mode="mathml"/>
<xsl:if test="(preceding-sibling::* and not(preceding-sibling::*[1][self::mathml:mo])) or (../preceding-sibling::* and not(../preceding-sibling::*[1][self::mathml:mo]))">
<xsl:if test="not(@lspace)">
<xsl:attribute name="lspace">0.4em</xsl:attribute>
<xsl:choose>
<xsl:when test="preceding-sibling::*[1][self::mathml:mi or self::mathml:mstyle]">
<xsl:attribute name="lspace">0.2em</xsl:attribute>
</xsl:when>
<xsl:when test="../preceding-sibling::*[1][self::mathml:mi or self::mathml:mstyle]">
<xsl:attribute name="lspace">0.2em</xsl:attribute>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:if>
<xsl:apply-templates mode="mathml"/>
</xsl:copy>
</xsl:template>

<!-- Examples:
<stem type="AsciiMath">x = 1</stem>
<stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
Expand Down

0 comments on commit 46792fb

Please sign in to comment.