Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/codecs/jats/__file_snapshots__/footnote.jats.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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/>
<abstract>
<p>The abstract can contain a footnote.</p>
</abstract>
</article-meta>
</front>
<body>
<sec>
<p>Further thoughts below.</p>
</sec>
</body>
<back/>
</article>
31 changes: 31 additions & 0 deletions src/codecs/jats/__file_snapshots__/footnote.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
type: Article
description:
- The abstract can contain a footnote.
- type: Note
id: note-1
noteType: Footnote
content:
- type: Paragraph
id: footnote1
content:
- A footnote from the abstract.
identifiers: []
title: Untitled
meta: {}
content:
- type: Paragraph
content:
- Further
- type: Note
id: note-2
noteType: Footnote
content:
- type: Paragraph
id: footnote2
content:
- 'An '
- type: Strong
content:
- important
- ' footnote.'
- ' thoughts below.'
7 changes: 6 additions & 1 deletion src/codecs/jats/__fixtures__/footnote.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?xml version="1.0"?>
<article>
<front>
<abstract>
<p>The abstract can contain a footnote.<fn id="note-1"><p id="footnote1">A footnote from the abstract.</p></fn></p>
</abstract>
</front>
<body>
<p>Further<fn id="note-1"><p id="Ch0.note-1">An <bold>important</bold> footnote.</p></fn> thoughts below.</p>
<p>Further<fn id="note-2"><p id="footnote2">An <bold>important</bold> footnote.</p></fn> thoughts below.</p>
</body>
</article>
2 changes: 1 addition & 1 deletion src/codecs/jats/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ function decodeAbstract(
state: DecodeState
): stencila.Article['description'] {
if (elem === null) return undefined
const ps = all(elem, 'p')
const ps = children(elem, 'p')
if (ps.length === 0) return undefined
if (ps.length === 1) {
const content = decodeInlineContent(ps, 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 @@ -77,6 +77,7 @@ describe('encode: Math', () => {
test.each([
'fig.xml',
'statement.xml',
'footnote.xml',
'quote.xml',
'elife-30274-v1',
'elife-43154-v2',
Expand Down