Skip to content

Commit

Permalink
Add empty mml:mi error
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-atherden committed Feb 13, 2024
1 parent 5f12433 commit 66a01dd
Show file tree
Hide file tree
Showing 16 changed files with 179,660 additions and 106,268 deletions.
4 changes: 3 additions & 1 deletion src/final-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2953,7 +2953,9 @@

</rule></pattern><pattern id="math-mi-tests-pattern"><rule context="mml:mi" id="math-mi-tests">

<report test="matches(.,'^\p{Zs}$')" role="error" id="math-mi-space-test">[math-mi-space-test] <name/> element contains only text. Has "\" been used for space in the tex editor, instead of "\,"?</report>
<report test="matches(.,'^\p{Zs}$')" role="error" id="math-mi-space-test">[math-mi-space-test] <name/> element contains only spaces. Has "\" been used for space in the tex editor, instead of "\,"?</report>

<report test="not(*) and normalize-space(.)=''" role="error" id="math-mi-empty-test">[math-mi-empty-test] <name/> element is completely empty. This is not allowed.</report>

</rule></pattern><pattern id="disp-formula-child-tests-pattern"><rule context="disp-formula/*" id="disp-formula-child-tests">

Expand Down
16 changes: 15 additions & 1 deletion src/final-JATS-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -16364,7 +16364,21 @@
</xsl:attribute>
<svrl:text>[math-mi-space-test] <xsl:text/>
<xsl:value-of select="name(.)"/>
<xsl:text/> element contains only text. Has "\" been used for space in the tex editor, instead of "\,"?</svrl:text>
<xsl:text/> element contains only spaces. Has "\" been used for space in the tex editor, instead of "\,"?</svrl:text>
</svrl:successful-report>
</xsl:if>

<!--REPORT error-->
<xsl:if test="not(*) and normalize-space(.)=''">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="not(*) and normalize-space(.)=''">
<xsl:attribute name="id">math-mi-empty-test</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[math-mi-empty-test] <xsl:text/>
<xsl:value-of select="name(.)"/>
<xsl:text/> element is completely empty. This is not allowed.</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M208"/>
Expand Down
4 changes: 3 additions & 1 deletion src/final-package-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2959,7 +2959,9 @@

</rule></pattern><pattern id="math-mi-tests-pattern"><rule context="mml:mi" id="math-mi-tests">

<report test="matches(.,'^\p{Zs}$')" role="error" id="math-mi-space-test"><name/> element contains only text. Has "\" been used for space in the tex editor, instead of "\,"?</report>
<report test="matches(.,'^\p{Zs}$')" role="error" id="math-mi-space-test"><name/> element contains only spaces. Has "\" been used for space in the tex editor, instead of "\,"?</report>

<report test="not(*) and normalize-space(.)=''" role="error" id="math-mi-empty-test"><name/> element is completely empty. This is not allowed.</report>

</rule></pattern><pattern id="disp-formula-child-tests-pattern"><rule context="disp-formula/*" id="disp-formula-child-tests">

Expand Down
4 changes: 3 additions & 1 deletion src/pre-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,9 @@

</rule></pattern><pattern id="math-mi-tests-pattern"><rule context="mml:mi" id="math-mi-tests">

<report test="matches(.,'^\p{Zs}$')" role="error" id="math-mi-space-test">[math-mi-space-test] <name/> element contains only text. Has "\" been used for space in the tex editor, instead of "\,"?</report>
<report test="matches(.,'^\p{Zs}$')" role="error" id="math-mi-space-test">[math-mi-space-test] <name/> element contains only spaces. Has "\" been used for space in the tex editor, instead of "\,"?</report>

<report test="not(*) and normalize-space(.)=''" role="error" id="math-mi-empty-test">[math-mi-empty-test] <name/> element is completely empty. This is not allowed.</report>

</rule></pattern><pattern id="disp-formula-child-tests-pattern"><rule context="disp-formula/*" id="disp-formula-child-tests">

Expand Down
16 changes: 15 additions & 1 deletion src/pre-JATS-schematron.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -16230,7 +16230,21 @@
</xsl:attribute>
<svrl:text>[math-mi-space-test] <xsl:text/>
<xsl:value-of select="name(.)"/>
<xsl:text/> element contains only text. Has "\" been used for space in the tex editor, instead of "\,"?</svrl:text>
<xsl:text/> element contains only spaces. Has "\" been used for space in the tex editor, instead of "\,"?</svrl:text>
</svrl:successful-report>
</xsl:if>

<!--REPORT error-->
<xsl:if test="not(*) and normalize-space(.)=''">
<svrl:successful-report xmlns:svrl="http://purl.oclc.org/dsdl/svrl" test="not(*) and normalize-space(.)=''">
<xsl:attribute name="id">math-mi-empty-test</xsl:attribute>
<xsl:attribute name="role">error</xsl:attribute>
<xsl:attribute name="location">
<xsl:apply-templates select="." mode="schematron-select-full-path"/>
</xsl:attribute>
<svrl:text>[math-mi-empty-test] <xsl:text/>
<xsl:value-of select="name(.)"/>
<xsl:text/> element is completely empty. This is not allowed.</svrl:text>
</svrl:successful-report>
</xsl:if>
<xsl:apply-templates select="*" mode="M206"/>
Expand Down
6 changes: 5 additions & 1 deletion src/schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -4763,7 +4763,11 @@ else self::*/local-name() = $allowed-p-blocks"

<report test="matches(.,'^\p{Zs}$')"
role="error"
id="math-mi-space-test"><name/> element contains only text. Has "\" been used for space in the tex editor, instead of "\,"?</report>
id="math-mi-space-test"><name/> element contains only spaces. Has "\" been used for space in the tex editor, instead of "\,"?</report>

<report test="not(*) and normalize-space(.)=''"
role="error"
id="math-mi-empty-test"><name/> element is completely empty. This is not allowed.</report>

</rule>

Expand Down
9 changes: 9 additions & 0 deletions test/tests/gen/math-mi-tests/math-mi-empty-test/fail.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?oxygen SCHSchema="math-mi-empty-test.sch"?>
<!--Context: mml:mi
Test: report not(*) and normalize-space(.)=''
Message: element is completely empty. This is not allowed. -->
<root xmlns:ali="http://www.niso.org/schemas/ali/1.0/" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">
<article>
<inline-formula><mml:math id="inf1"><mml:mstyle displaystyle="true" scriptlevel="0"><mml:mrow class="MJX-TeXAtom-ORD"><mml:mover><mml:mi/><mml:mo stretchy="false">¯</mml:mo></mml:mover></mml:mrow></mml:mstyle></mml:math></inline-formula>
</article>
</root>
Loading

0 comments on commit 66a01dd

Please sign in to comment.