Skip to content

Commit

Permalink
RP - add more sub-article checks
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-atherden committed Jan 24, 2025
1 parent 884fe02 commit fefd135
Show file tree
Hide file tree
Showing 30 changed files with 965 additions and 254 deletions.
41 changes: 27 additions & 14 deletions src/rp-schematron-base.sch
Original file line number Diff line number Diff line change
Expand Up @@ -972,12 +972,9 @@

<pattern id="supplementary-material">
<rule context="supplementary-material" id="supplementary-material-checks">

<!-- Temporary error while no support for supplementary-material in EPP
sec sec-type="supplementary-material" is stripped from XML via xslt -->
<assert test="ancestor::sec[@sec-type='supplementary-material']"
role="error"
id="supplementary-material-temp-test">supplementary-material element is not placed within a &lt;sec sec-type="supplementary-material">. There is currently no support for supplementary-material in RPs. Please either move the supplementary-material under an existing &lt;sec sec-type="supplementary-material"> or add a new &lt;sec sec-type="supplementary-material"> around this an any other supplementary-material.</assert>
role="warning"
id="supplementary-material-temp-test">supplementary-material element is not placed within a &lt;sec sec-type="supplementary-material">. Is that correct?.</assert>

<assert test="media"
role="error"
Expand Down Expand Up @@ -2210,20 +2207,30 @@
</pattern>

<pattern id="author-response-checks">
<!-- Need to change this when peer review XML is handled differently -->
<rule context="sub-article[@article-type='author-comment']/body//bold[not(preceding-sibling::text() or preceding-sibling::*) and (parent::p/following-sibling::*[1]/ext-link/inline-graphic or parent::p/following-sibling::*[1]/inline-graphic or parent::p/following-sibling::*[2]/ext-link/inline-graphic or parent::p/following-sibling::*[2]/inline-graphic)]" id="ar-bold-checks">
<assert test="matches(.,'Author response (image|table) \d\d?\.')"
<rule context="sub-article[@article-type='author-comment']//fig/label" id="ar-image-labels">
<assert test="matches(.,'^Author response image \d\d?\.$')"
role="error"
id="ar-image-label-1">Label for figures in the author response must be in the format 'Author response image 0.' This one is not: '<value-of select="."/>'</assert>
</rule>

<rule context="sub-article[@article-type='author-comment']//table-wrap/label" id="ar-table-labels">
<assert test="matches(.,'^Author response table \d\d?\.$')"
role="error"
id="ar-bold-image">The bold text in a label preceding an image in the author response must be in the format 'Author response image 1.' or 'Author response table 1.' - this one is not - <value-of select="."/></assert>
id="ar-table-label-1">Label for tables in the author response must be in the format 'Author response table 0.' This one is not: '<value-of select="."/>'</assert>
</rule>
</pattern>

<pattern id="public-review-checks">
<!-- Need to change this when peer review XML is handled differently -->
<rule context="sub-article[@article-type='referee-report']/body//bold[not(preceding-sibling::text() or preceding-sibling::*) and (parent::p/following-sibling::*[1]/ext-link/inline-graphic or parent::p/following-sibling::*[1]/inline-graphic or parent::p/following-sibling::*[2]/ext-link/inline-graphic or parent::p/following-sibling::*[2]/inline-graphic)]" id="pr-bold-checks">
<assert test="matches(.,'Review (image|table) \d\d?\.')"
<rule context="sub-article[@article-type='referee-report']//fig/label" id="pr-image-labels">
<assert test="matches(.,'^Review image \d\d?\.$')"
role="error"
id="pr-bold-image">The bold text in a label preceding an image in a public review must be in the format 'Review 1.' or 'Review table 1.' - this one is not - <value-of select="."/></assert>
id="pr-image-label-1">Label for figures in public reviews must be in the format 'Review image 0.' This one is not: '<value-of select="."/>'</assert>
</rule>

<rule context="sub-article[@article-type='referee-report']//table-wrap/label" id="pr-table-labels">
<assert test="matches(.,'^Review table \d\d?\.$')"
role="error"
id="pr-table-label-1">Label for tables in public reviews must be in the format 'Review table 0.' This one is not: '<value-of select="."/>'</assert>
</rule>
</pattern>

Expand Down Expand Up @@ -2264,7 +2271,13 @@
<rule context="sub-article/body//p" id="sub-article-bold-image-checks">
<report test="bold[matches(lower-case(.),'(image|table)')] and (inline-graphic or graphic or ext-link[inline-graphic or graphic])"
role="error"
id="sub-article-bold-image-1">p element contains both bold text (a label for an image or table) and a graphic. These should be in separate paragraphs.</report>
id="sub-article-bold-image-1">p element contains both bold text (a label for an image or table) and a graphic. These should be in separate paragraphs (so that they are correctly processed into fig or table-wrap).</report>
</rule>

<rule context="sub-article/body//inline-graphic" id="sub-article-inline-graphics">
<assert test="parent::inline-formula or parent::alternatives[inline-formula]"
role="error"
id="sub-article-inline-graphic">inline-graphic in sub-article should only be placed as a child of inline-formula (or a child of alternatives in inline-formula). This one is not (uri=<value-of select="@xlink:href"/>).</assert>
</rule>
</pattern>

Expand Down
21 changes: 12 additions & 9 deletions src/rp-schematron.sch
Original file line number Diff line number Diff line change
Expand Up @@ -552,10 +552,7 @@
</rule></pattern>

<pattern id="supplementary-material-checks-pattern"><rule context="supplementary-material" id="supplementary-material-checks">

<!-- Temporary error while no support for supplementary-material in EPP
sec sec-type="supplementary-material" is stripped from XML via xslt -->
<assert test="ancestor::sec[@sec-type='supplementary-material']" role="error" id="supplementary-material-temp-test">[supplementary-material-temp-test] supplementary-material element is not placed within a &lt;sec sec-type="supplementary-material"&gt;. There is currently no support for supplementary-material in RPs. Please either move the supplementary-material under an existing &lt;sec sec-type="supplementary-material"&gt; or add a new &lt;sec sec-type="supplementary-material"&gt; around this an any other supplementary-material.</assert>
<assert test="ancestor::sec[@sec-type='supplementary-material']" role="warning" id="supplementary-material-temp-test">[supplementary-material-temp-test] supplementary-material element is not placed within a &lt;sec sec-type="supplementary-material"&gt;. Is that correct?.</assert>

<assert test="media" role="error" id="supplementary-material-test-1">[supplementary-material-test-1] supplementary-material does not have a child media. It must either have a file or be deleted.</assert>

Expand Down Expand Up @@ -1167,12 +1164,16 @@
<report test="preceding-sibling::bold[replace(lower-case(.),'ly$','') = $normalized-kwd]" role="warning" id="ed-report-bold-terms-3">[ed-report-bold-terms-3] There is more than one of the same <value-of select="if (replace(lower-case(.),'ly$','')=$str-kwds) then 'strength' else 'significance'"/> keywords in the assessment - <value-of select="$normalized-kwd"/>. This is very likely to be incorrect.</report>
</rule></pattern>

<pattern id="ar-bold-checks-pattern"><rule context="sub-article[@article-type='author-comment']/body//bold[not(preceding-sibling::text() or preceding-sibling::*) and (parent::p/following-sibling::*[1]/ext-link/inline-graphic or parent::p/following-sibling::*[1]/inline-graphic or parent::p/following-sibling::*[2]/ext-link/inline-graphic or parent::p/following-sibling::*[2]/inline-graphic)]" id="ar-bold-checks">
<assert test="matches(.,'Author response (image|table) \d\d?\.')" role="error" id="ar-bold-image">[ar-bold-image] The bold text in a label preceding an image in the author response must be in the format 'Author response image 1.' or 'Author response table 1.' - this one is not - <value-of select="."/></assert>
<pattern id="ar-image-labels-pattern"><rule context="sub-article[@article-type='author-comment']//fig/label" id="ar-image-labels">
<assert test="matches(.,'^Author response image \d\d?\.$')" role="error" id="ar-image-label-1">[ar-image-label-1] Label for figures in the author response must be in the format 'Author response image 0.' This one is not: '<value-of select="."/>'</assert>
</rule></pattern><pattern id="ar-table-labels-pattern"><rule context="sub-article[@article-type='author-comment']//table-wrap/label" id="ar-table-labels">
<assert test="matches(.,'^Author response table \d\d?\.$')" role="error" id="ar-table-label-1">[ar-table-label-1] Label for tables in the author response must be in the format 'Author response table 0.' This one is not: '<value-of select="."/>'</assert>
</rule></pattern>

<pattern id="pr-bold-checks-pattern"><rule context="sub-article[@article-type='referee-report']/body//bold[not(preceding-sibling::text() or preceding-sibling::*) and (parent::p/following-sibling::*[1]/ext-link/inline-graphic or parent::p/following-sibling::*[1]/inline-graphic or parent::p/following-sibling::*[2]/ext-link/inline-graphic or parent::p/following-sibling::*[2]/inline-graphic)]" id="pr-bold-checks">
<assert test="matches(.,'Review (image|table) \d\d?\.')" role="error" id="pr-bold-image">[pr-bold-image] The bold text in a label preceding an image in a public review must be in the format 'Review 1.' or 'Review table 1.' - this one is not - <value-of select="."/></assert>
<pattern id="pr-image-labels-pattern"><rule context="sub-article[@article-type='referee-report']//fig/label" id="pr-image-labels">
<assert test="matches(.,'^Review image \d\d?\.$')" role="error" id="pr-image-label-1">[pr-image-label-1] Label for figures in public reviews must be in the format 'Review image 0.' This one is not: '<value-of select="."/>'</assert>
</rule></pattern><pattern id="pr-table-labels-pattern"><rule context="sub-article[@article-type='referee-report']//table-wrap/label" id="pr-table-labels">
<assert test="matches(.,'^Review table \d\d?\.$')" role="error" id="pr-table-label-1">[pr-table-label-1] Label for tables in public reviews must be in the format 'Review table 0.' This one is not: '<value-of select="."/>'</assert>
</rule></pattern>

<pattern id="sub-article-title-checks-pattern"><rule context="sub-article/front-stub/title-group/article-title" id="sub-article-title-checks">
Expand All @@ -1191,7 +1192,9 @@

<assert test="starts-with(.,$article-version-doi)" role="error" id="sub-article-doi-check-2">[sub-article-doi-check-2] The DOI for this sub-article (<value-of select="."/>) does not start with the version DOI for the Reviewed Preprint (<value-of select="$article-version-doi"/>).</assert>
</rule></pattern><pattern id="sub-article-bold-image-checks-pattern"><rule context="sub-article/body//p" id="sub-article-bold-image-checks">
<report test="bold[matches(lower-case(.),'(image|table)')] and (inline-graphic or graphic or ext-link[inline-graphic or graphic])" role="error" id="sub-article-bold-image-1">[sub-article-bold-image-1] p element contains both bold text (a label for an image or table) and a graphic. These should be in separate paragraphs.</report>
<report test="bold[matches(lower-case(.),'(image|table)')] and (inline-graphic or graphic or ext-link[inline-graphic or graphic])" role="error" id="sub-article-bold-image-1">[sub-article-bold-image-1] p element contains both bold text (a label for an image or table) and a graphic. These should be in separate paragraphs (so that they are correctly processed into fig or table-wrap).</report>
</rule></pattern><pattern id="sub-article-inline-graphics-pattern"><rule context="sub-article/body//inline-graphic" id="sub-article-inline-graphics">
<assert test="parent::inline-formula or parent::alternatives[inline-formula]" role="error" id="sub-article-inline-graphic">[sub-article-inline-graphic] inline-graphic in sub-article should only be placed as a child of inline-formula (or a child of alternatives in inline-formula). This one is not (uri=<value-of select="@xlink:href"/>).</assert>
</rule></pattern>

<pattern id="arxiv-journal-meta-checks-pattern"><rule context="article/front/journal-meta[lower-case(journal-id[1])='arxiv']" id="arxiv-journal-meta-checks">
Expand Down
Loading

0 comments on commit fefd135

Please sign in to comment.