Skip to content

Commit

Permalink
fix(JATS): Do not duplicate ListItems when decoding nested lists
Browse files Browse the repository at this point in the history
  • Loading branch information
nokome committed May 22, 2023
1 parent a08cfb7 commit abb3a18
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 30 deletions.
9 changes: 0 additions & 9 deletions src/codecs/jats/__file_snapshots__/f1000-7-1655-v1.jats.xml
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,6 @@
</list-item>
</list>
</list-item>
<list-item>
<p>Reviewing the content for sensitive information, e.g., unpublished data additions and confidentiality leaks, as well ensuring the tone of the report is appropriate</p>
</list-item>
<list-item>
<p>Removing author responses that contain data the author wants to publish in a subsequent paper</p>
</list-item>
<list-item>
<p>Arbitration processes for conflicting reviews</p>
</list-item>
</list>
<p>Where time is spent—whether in the editorial or production process—depends on the publisher workflow. Regardless of workflow, the overlap in tasks identified provides evidence of the potential value of updating the infrastructure of submission systems to account for and streamline these efforts. Coordination between publishers and submission systems could minimize the time spent “stitching together” peer review materials into a publishable format.</p>
<p>In addition to time and workflow hurdles, another major challenge noted by those publishers without their own hosting platforms, was the actual publication process and online hosting of peer review materials. Many publishers identified that some online hosts were not able to manage this new content type. As a result, peer review materials are being captured in supplementary material sections because alternative options are not available. In such cases, it becomes more difficult to capture any relevant associated metadata in a meaningful way for the peer review materials or to make this valuable content easily discoverable.</p>
Expand Down
20 changes: 0 additions & 20 deletions src/codecs/jats/__file_snapshots__/f1000-7-1655-v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -682,26 +682,6 @@ content:
order: Unordered
meta:
listType: bullet
- type: ListItem
content:
- type: Paragraph
content:
- >-
Reviewing the content for sensitive information, e.g.,
unpublished data additions and confidentiality leaks, as well
ensuring the tone of the report is appropriate
- type: ListItem
content:
- type: Paragraph
content:
- >-
Removing author responses that contain data the author wants to
publish in a subsequent paper
- type: ListItem
content:
- type: Paragraph
content:
- Arbitration processes for conflicting reviews
order: Unordered
meta:
listType: bullet
Expand Down
58 changes: 58 additions & 0 deletions src/codecs/jats/__file_snapshots__/nested-list.jats.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.1 20151215//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" article-type="research-article">
<front>
<article-meta>
<title-group>
<article-title>Untitled</article-title>
</title-group>
<contrib-group/>
</article-meta>
</front>
<body>
<sec>
<list list-type="bullet">
<list-item>
<p>A</p>
</list-item>
<list-item>
<p>B
</p>
<list list-type="bullet">
<list-item>
<p>B1</p>
</list-item>
<list-item>
<p>B2</p>
</list-item>
<list-item>
<p>B3</p>
</list-item>
</list>
</list-item>
<list-item>
<p>C</p>
</list-item>
<list-item>
<p>D
</p>
<list list-type="bullet">
<list-item>
<p>D1</p>
</list-item>
<list-item>
<p>D2</p>
</list-item>
<list-item>
<p>D3</p>
</list-item>
</list>
</list-item>
<list-item>
<p>E</p>
</list-item>
</list>
</sec>
</body>
<back/>
</article>
79 changes: 79 additions & 0 deletions src/codecs/jats/__file_snapshots__/nested-list.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
type: Article
identifiers: []
title: Untitled
meta: {}
content:
- type: List
items:
- type: ListItem
content:
- type: Paragraph
content:
- A
- type: ListItem
content:
- type: Paragraph
content:
- |-
B
- type: List
items:
- type: ListItem
content:
- type: Paragraph
content:
- B1
- type: ListItem
content:
- type: Paragraph
content:
- B2
- type: ListItem
content:
- type: Paragraph
content:
- B3
order: Unordered
meta:
listType: bullet
- type: ListItem
content:
- type: Paragraph
content:
- C
- type: ListItem
content:
- type: Paragraph
content:
- |-
D
- type: List
items:
- type: ListItem
content:
- type: Paragraph
content:
- D1
- type: ListItem
content:
- type: Paragraph
content:
- D2
- type: ListItem
content:
- type: Paragraph
content:
- D3
order: Unordered
meta:
listType: bullet
- type: ListItem
content:
- type: Paragraph
content:
- E
order: Unordered
meta:
listType: bullet
32 changes: 32 additions & 0 deletions src/codecs/jats/__fixtures__/nested-list.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<article>
<front>
<article-meta>
<contrib-group />
</article-meta>
</front>
<body>
<list list-type="bullet">
<list-item><p>A</p></list-item>
<list-item><p>B
<list list-type="bullet">
<list-item><p>B1</p></list-item>
<list-item><p>B2</p></list-item>
<list-item><p>B3</p></list-item>
</list>
</p></list-item>
<list-item><p>C</p></list-item>
<list-item><p>D
<list list-type="bullet">
<list-item><p>D1</p></list-item>
<list-item><p>D2</p></list-item>
<list-item><p>D3</p></list-item>
</list>
</p></list-item>
<list-item><p>E</p></list-item>
</list>
</body>
<back>
<app-group />
</back>
</article>
2 changes: 1 addition & 1 deletion src/codecs/jats/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,7 @@ function decodeList(elem: xml.Element, state: DecodeState): [stencila.List] {
const type = attr(elem, 'list-type')
const order =
type === 'bullet' || type === 'simple' ? 'Unordered' : 'Ascending'
const items = all(elem, 'list-item').map((item): stencila.ListItem => {
const items = children(elem, 'list-item').map((item): stencila.ListItem => {
return stencila.listItem({
content: ensureBlockContentArray(
decodeElements(item.elements ?? [], state)
Expand Down
1 change: 1 addition & 0 deletions src/codecs/jats/jats.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ test.each([
'fig.xml',
'statement.xml',
'quote.xml',
'nested-list.xml',
'elife-30274-v1',
'elife-43154-v2',
'elife-46472-v3',
Expand Down

0 comments on commit abb3a18

Please sign in to comment.