Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common xslt updated for mathml rendering fix, metanorma/mn2pdf#218 #591

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions xslt_src/common.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11305,6 +11305,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
Loading