Skip to content

Commit

Permalink
fix(JATS): Fix loss of content when <list-item><label> has trailing…
Browse files Browse the repository at this point in the history
… space
  • Loading branch information
Nokome Bentley committed May 26, 2023
1 parent 2f81d9c commit 7599817
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 35 deletions.
32 changes: 16 additions & 16 deletions src/codecs/jats/__file_snapshots__/f1000-7-1655-v1.jats.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,13 @@
<p>Publishers are approaching the publication of peer review materials in a number of ways. The aims of this group were not to prescribe what should be done from an editorial point of view, but to enable what is published to be found by readers and machines alike. Prior to the workshop, data were collected from each publisher attending and we found the following materials are published:</p>
<list list-type="bullet">
<list-item>
<p>○ </p>
<p>○ Peer review reports, anonymized or with report author names</p>
</list-item>
<list-item>
<p>○ </p>
<p>○ Author responses/Rebuttals</p>
</list-item>
<list-item>
<p>○ </p>
<p>○ Editor decision letters</p>
</list-item>
</list>
<p>Some journals also provide appeal and resubmission information (including previous versions of the article, dates, and actors involved).</p>
Expand All @@ -248,13 +248,13 @@
<p>In order to advance the transparency and recognition of peer review materials, we agreed these peer review materials need to stand alone from the main article for the purposes of, for example, credit and citation. Ideally, each content item should have its own DOI (as per the recently enhanced Crossref schema). We identified three levels of achieving this, with level 1 being the basic and least preferred option, but probably currently the most achievable and pragmatic:</p>
<list list-type="bullet">
<list-item>
<p>1. </p>
<p>1. Peer review materials are attached to the article as a single or numerous PDFs. Whether these materials are pulled together into one document or attached as separate documents, there should be some defined mechanism in the JATS XML tagging that would support the capture of any available metadata and identify these files in a machine-readable and interoperable way for publishers to tag this content appropriately.</p>
</list-item>
<list-item>
<p>2. </p>
<p>2. Peer review materials are appended to the article within the full text (so all is machine readable) as a sub-article component of the XML.</p>
</list-item>
<list-item>
<p>3. </p>
<p>3. Peer review materials are full-text XML “articles” or “commentaries” in their own right that link bidirectionally to the main article.</p>
</list-item>
</list>
</sec>
Expand Down Expand Up @@ -339,10 +339,10 @@
<p>Review documents may be supplied as:</p>
<list list-type="bullet">
<list-item>
<p>1. </p>
<p>1. sub-articles &lt;sub-article&gt; to the article being reviewed (sub-articles may be full-text XML or XML metadata plus a link to the PDF)</p>
</list-item>
<list-item>
<p>2. </p>
<p>2. independent articles &lt;article&gt; (with the appropriate &lt;related-article&gt; links – Peer Reviews MUST link to the version of the article they are reviewing and Author Replies; Decision Letters MUST link to the version of the article they are passing judgment on; and Author Replies MUST link to each Review/Decision Letter it is addressing)</p>
</list-item>
</list>
</sec>
Expand Down Expand Up @@ -404,13 +404,13 @@
<p>If &lt;contrib&gt; is used, it MUST contain @contrib-type that maps to following controlled vocabulary:</p>
<list list-type="bullet">
<list-item>
<p>○ </p>
<p>○ For Peer Reviews, use @contrib-type=“reviewer”</p>
</list-item>
<list-item>
<p>○ </p>
<p>○ For Decision Letters, use @contrib-type=“editor”</p>
</list-item>
<list-item>
<p>○ </p>
<p>○ For Author Reply, use @contrib-type=“author”</p>
</list-item>
</list>
<p>We intend that the @contrib-type attribute value reflects the contributor’s relationship to the peer review process and not the relationship with the document.</p>
Expand Down Expand Up @@ -447,19 +447,19 @@
<p>There are some elements that MUST NOT appear in review documents:</p>
<list list-type="bullet">
<list-item>
<p>a. </p>
<p>a. &lt;funding-group&gt;</p>
</list-item>
<list-item>
<p>b. </p>
<p>b. &lt;app&gt;, &lt;app-group&gt;, &lt;ack&gt;, &lt;glossary&gt;, &lt;back&gt;/&lt;sec&gt;</p>
</list-item>
<list-item>
<p>c. </p>
<p>c. &lt;supplementary-material&gt;, &lt;inline-supplementary-material&gt;</p>
</list-item>
<list-item>
<p>d. </p>
<p>d. &lt;bio&gt;</p>
</list-item>
<list-item>
<p>e. </p>
<p>e. &lt;article-version&gt; Once published, review documents will not be “versioned”. If the reviewer(s) write a review on an updated version of the manuscript, the peer review is a new published object.</p>
</list-item>
</list>
</sec>
Expand Down
58 changes: 42 additions & 16 deletions src/codecs/jats/__file_snapshots__/f1000-7-1655-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,17 +456,17 @@ content:
content:
- type: Paragraph
content:
- ''
- ○ Peer review reports, anonymized or with report author names
- type: ListItem
content:
- type: Paragraph
content:
- ''
- ○ Author responses/Rebuttals
- type: ListItem
content:
- type: Paragraph
content:
- ''
- ○ Editor decision letters
order: Unordered
meta:
listType: bullet
Expand Down Expand Up @@ -551,17 +551,30 @@ content:
content:
- type: Paragraph
content:
- '1. '
- >-
1. Peer review materials are attached to the article as a single
or numerous PDFs. Whether these materials are pulled together
into one document or attached as separate documents, there
should be some defined mechanism in the JATS XML tagging that
would support the capture of any available metadata and identify
these files in a machine-readable and interoperable way for
publishers to tag this content appropriately.
- type: ListItem
content:
- type: Paragraph
content:
- '2. '
- >-
2. Peer review materials are appended to the article within the
full text (so all is machine readable) as a sub-article
component of the XML.
- type: ListItem
content:
- type: Paragraph
content:
- '3. '
- >-
3. Peer review materials are full-text XML “articles” or
“commentaries” in their own right that link bidirectionally to
the main article.
order: Unordered
meta:
listType: bullet
Expand Down Expand Up @@ -816,12 +829,21 @@ content:
content:
- type: Paragraph
content:
- '1. '
- >-
1. sub-articles <sub-article> to the article being reviewed
(sub-articles may be full-text XML or XML metadata plus a link
to the PDF)
- type: ListItem
content:
- type: Paragraph
content:
- '2. '
- >-
2. independent articles <article> (with the appropriate
<related-article> links – Peer Reviews MUST link to the version
of the article they are reviewing and Author Replies; Decision
Letters MUST link to the version of the article they are passing
judgment on; and Author Replies MUST link to each
Review/Decision Letter it is addressing)
order: Unordered
meta:
listType: bullet
Expand Down Expand Up @@ -973,17 +995,17 @@ content:
content:
- type: Paragraph
content:
- ''
- ○ For Peer Reviews, use @contrib-type=“reviewer”
- type: ListItem
content:
- type: Paragraph
content:
- ''
- ○ For Decision Letters, use @contrib-type=“editor”
- type: ListItem
content:
- type: Paragraph
content:
- ''
- ○ For Author Reply, use @contrib-type=“author”
order: Unordered
meta:
listType: bullet
Expand Down Expand Up @@ -1081,27 +1103,31 @@ content:
content:
- type: Paragraph
content:
- 'a. '
- a. <funding-group>
- type: ListItem
content:
- type: Paragraph
content:
- 'b. '
- b. <app>, <app-group>, <ack>, <glossary>, <back>/<sec>
- type: ListItem
content:
- type: Paragraph
content:
- 'c. '
- c. <supplementary-material>, <inline-supplementary-material>
- type: ListItem
content:
- type: Paragraph
content:
- 'd. '
- d. <bio>
- type: ListItem
content:
- type: Paragraph
content:
- 'e. '
- >-
e. <article-version> Once published, review documents will not
be “versioned”. If the reviewer(s) write a review on an updated
version of the manuscript, the peer review is a new published
object.
order: Unordered
meta:
listType: bullet
Expand Down
5 changes: 2 additions & 3 deletions src/codecs/jats/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2131,9 +2131,8 @@ function decodeList(elem: xml.Element, state: DecodeState): [stencila.List] {
) {
const label = text(children.shift()!)
// Note: now former child [0] is child [1]
children[0].elements![0].text = label.endsWith(' ')
? label
: label + ' ' + text(children[0])
children[0].elements![0].text =
(label.endsWith(' ') ? label : label + ' ') + text(children[0])
}
return stencila.listItem({
content: ensureBlockContentArray(decodeElements(children, state)),
Expand Down

0 comments on commit 7599817

Please sign in to comment.