Skip to content

Commit

Permalink
Add PMC stylechecker mathml checks
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-atherden committed Mar 13, 2024
1 parent 3595c47 commit 240212d
Show file tree
Hide file tree
Showing 17 changed files with 8,731 additions and 4,398 deletions.
9 changes: 9 additions & 0 deletions src/final-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2968,6 +2968,15 @@

<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>

</rule></pattern><pattern id="math-empty-child-tests-pattern"><rule context="msub|msup|msubsup|munder|mover|munderover" id="math-empty-child-tests">
<let name="script-name" value="if (./name() = 'msub') then 'subscript' else if (./name() = 'msup') then 'superscript' else if (./name() = 'msubsup') then 'subscript' else if (./name() = 'munder') then 'underscript' else if (./name() = 'mover') then 'overscript' else if (./name() = 'munderover') then 'underscript' else 'second'"/>

<assert test="*[1][normalize-space(descendant-or-self::*[text()])]" role="error" id="math-empty-base-check">[math-empty-base-check] <name/> element must not have an empty base expression.</assert>

<assert test="*[2][normalize-space(descendant-or-self::*[text()])]" role="error" id="math-empty-script-check">[math-empty-script-check] <name/> element must not have an empty <value-of select="$script-name"/> expression.</assert>

<report test="name()=('msubsup','munderover') and not(*[3][normalize-space(descendant-or-self::*[text()])])" role="error" id="math-empty-second-script-check">[math-empty-second-script-check] <name/> element must not have an empty <value-of select="if (name()='msubsup') then 'superscript' else 'overscript'"/> expression.</report>

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

<report see="https://elifeproduction.slab.com/posts/maths-0gfptlyl#disp-formula-child-test-1" test="not(local-name()=('label','math'))" role="error" id="disp-formula-child-test-1">[disp-formula-child-test-1] <name/> element is not allowed as a child of disp-formula.</report>
Expand Down
4,478 changes: 2,276 additions & 2,202 deletions src/final-JATS-schematron.xsl

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions src/final-package-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2974,6 +2974,15 @@

<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>

</rule></pattern><pattern id="math-empty-child-tests-pattern"><rule context="msub|msup|msubsup|munder|mover|munderover" id="math-empty-child-tests">
<let name="script-name" value="if (./name() = 'msub') then 'subscript' else if (./name() = 'msup') then 'superscript' else if (./name() = 'msubsup') then 'subscript' else if (./name() = 'munder') then 'underscript' else if (./name() = 'mover') then 'overscript' else if (./name() = 'munderover') then 'underscript' else 'second'"/>

<assert test="*[1][normalize-space(descendant-or-self::*[text()])]" role="error" id="math-empty-base-check"><name/> element must not have an empty base expression.</assert>

<assert test="*[2][normalize-space(descendant-or-self::*[text()])]" role="error" id="math-empty-script-check"><name/> element must not have an empty <value-of select="$script-name"/> expression.</assert>

<report test="name()=('msubsup','munderover') and not(*[3][normalize-space(descendant-or-self::*[text()])])" role="error" id="math-empty-second-script-check"><name/> element must not have an empty <value-of select="if (name()='msubsup') then 'superscript' else 'overscript'"/> expression.</report>

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

<report see="https://elifeproduction.slab.com/posts/maths-0gfptlyl#disp-formula-child-test-1" test="not(local-name()=('label','math'))" role="error" id="disp-formula-child-test-1"><name/> element is not allowed as a child of disp-formula.</report>
Expand Down
9 changes: 9 additions & 0 deletions src/pre-JATS-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -2913,6 +2913,15 @@

<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>

</rule></pattern><pattern id="math-empty-child-tests-pattern"><rule context="msub|msup|msubsup|munder|mover|munderover" id="math-empty-child-tests">
<let name="script-name" value="if (./name() = 'msub') then 'subscript' else if (./name() = 'msup') then 'superscript' else if (./name() = 'msubsup') then 'subscript' else if (./name() = 'munder') then 'underscript' else if (./name() = 'mover') then 'overscript' else if (./name() = 'munderover') then 'underscript' else 'second'"/>

<assert test="*[1][normalize-space(descendant-or-self::*[text()])]" role="error" id="math-empty-base-check">[math-empty-base-check] <name/> element must not have an empty base expression.</assert>

<assert test="*[2][normalize-space(descendant-or-self::*[text()])]" role="error" id="math-empty-script-check">[math-empty-script-check] <name/> element must not have an empty <value-of select="$script-name"/> expression.</assert>

<report test="name()=('msubsup','munderover') and not(*[3][normalize-space(descendant-or-self::*[text()])])" role="error" id="math-empty-second-script-check">[math-empty-second-script-check] <name/> element must not have an empty <value-of select="if (name()='msubsup') then 'superscript' else 'overscript'"/> expression.</report>

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

<report see="https://elifeproduction.slab.com/posts/maths-0gfptlyl#disp-formula-child-test-1" test="not(local-name()=('label','math'))" role="error" id="disp-formula-child-test-1">[disp-formula-child-test-1] <name/> element is not allowed as a child of disp-formula.</report>
Expand Down
Loading

0 comments on commit 240212d

Please sign in to comment.