Skip to content

Commit

Permalink
RP XSL - add ethics-statement sec-type
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-atherden committed Feb 13, 2025
1 parent 10cd35b commit 6ea7b21
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/preprint-changes.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,20 @@
<xsl:apply-templates select="*|text()|comment()|processing-instruction()"/>
</xsl:copy>
</xsl:template>

<!-- Add sec-type="ethics-statement" -->
<xsl:template xml:id="sec-ethics" match="sec[(not(@sec-type)) and matches(lower-case(title[1]),'ethics') and not(matches(lower-case(title[1]),'data') and matches(lower-case(title[1]),'ava[il][il]ability|access|sharing')) and not(ancestor::sec[matches(lower-case(title[1]),'ethics')])]">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="sec-type">ethics-statement</xsl:attribute>
<xsl:if test="not(@id)">
<xsl:attribute name="id">
<xsl:value-of select="generate-id(.)"/>
</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="*|text()|comment()|processing-instruction()"/>
</xsl:copy>
</xsl:template>

<!-- Strip unnecessary bolding and italicisation from inside citations -->
<xsl:template xml:id="strip-bold-italic-around-xref" match="xref/bold[italic[not(xref)]]
Expand Down
6 changes: 3 additions & 3 deletions test/tests/preprint-changes/rearrange-back/output.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<title>Something else</title>
<p>...</p>
</ack>
<sec id="d545e19" sec-type="additional-information">
<sec id="d556e19" sec-type="additional-information">
<title>Additional information</title>
<sec id="s5">
<title>Funding</title>
Expand All @@ -41,9 +41,9 @@
<p>All code and software needed to generate the results is available as part of public resources: LD score regression (<ext-link ext-link-type="uri" xlink:href="https://github.com/bulik/ldsc">https://github.com/bulik/ldsc</ext-link>), FUMA (<ext-link ext-link-type="uri" xlink:href="https://fuma.ctglab.nl/">https://fuma.ctglab.nl/</ext-link>), MiXeR (<ext-link ext-link-type="uri" xlink:href="https://github.com/precimed/mixer">https://github.com/precimed/mixer</ext-link>), BM location (simulation, training, and model) <italic>[made public upon acceptance]</italic>.</p>
</sec>
</sec>
<sec id="suppd545e19" sec-type="supplementary-material">
<sec id="suppd556e19" sec-type="supplementary-material">
<title>Additional files</title>
<supplementary-material id="d545e10">
<supplementary-material id="d556e10">
<label>Supplementary materials</label>
<media xlink:href="supplements/278950_file02.docx"/>
</supplementary-material>
Expand Down
13 changes: 13 additions & 0 deletions test/tests/preprint-changes/sec-ethics/input.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--Testing template with id: sec-ethics-->
<sec id="s4">
<title>ETHICS STATEMENT</title>
<sec>
<title>Human</title>
</sec>
<sec>
<title>Monkey</title>
</sec>
<sec>
<title>Machine</title>
</sec>
</sec>
13 changes: 13 additions & 0 deletions test/tests/preprint-changes/sec-ethics/output.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--Testing template with id: sec-ethics-->
<sec id="s4" sec-type="ethics-statement">
<title>ETHICS STATEMENT</title>
<sec>
<title>Human</title>
</sec>
<sec>
<title>Monkey</title>
</sec>
<sec>
<title>Machine</title>
</sec>
</sec>
4 changes: 4 additions & 0 deletions test/xspec/preprint-changes.xspec
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@
<x:context href="../tests/preprint-changes/sec-data-availability/input.xml"/>
<x:expect label="Testing the template: sec-data-availability" href="../tests/preprint-changes/sec-data-availability/output.xml"/>
</x:scenario>
<x:scenario label="sec-ethics">
<x:context href="../tests/preprint-changes/sec-ethics/input.xml"/>
<x:expect label="Testing the template: sec-ethics" href="../tests/preprint-changes/sec-ethics/output.xml"/>
</x:scenario>
<x:scenario label="strip-bold-italic-around-xref">
<x:context href="../tests/preprint-changes/strip-bold-italic-around-xref/input.xml"/>
<x:expect label="Testing the template: strip-bold-italic-around-xref" href="../tests/preprint-changes/strip-bold-italic-around-xref/output.xml"/>
Expand Down

0 comments on commit 6ea7b21

Please sign in to comment.