diff --git a/src/codecs/jats/__file_snapshots__/footnote.jats.xml b/src/codecs/jats/__file_snapshots__/footnote.jats.xml new file mode 100644 index 000000000..01f7d7b9d --- /dev/null +++ b/src/codecs/jats/__file_snapshots__/footnote.jats.xml @@ -0,0 +1,21 @@ + + +
+ + + + Untitled + + + +

The abstract can contain a footnote.

+
+
+
+ + +

Further thoughts below.

+
+ + +
\ No newline at end of file diff --git a/src/codecs/jats/__file_snapshots__/footnote.yaml b/src/codecs/jats/__file_snapshots__/footnote.yaml new file mode 100644 index 000000000..900ee79c6 --- /dev/null +++ b/src/codecs/jats/__file_snapshots__/footnote.yaml @@ -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.' diff --git a/src/codecs/jats/__fixtures__/footnote.xml b/src/codecs/jats/__fixtures__/footnote.xml index dacf91862..b2cacf0ef 100644 --- a/src/codecs/jats/__fixtures__/footnote.xml +++ b/src/codecs/jats/__fixtures__/footnote.xml @@ -1,6 +1,11 @@
+ + +

The abstract can contain a footnote.

A footnote from the abstract.

+
+
-

Further

An important footnote.

thoughts below.

+

Further

An important footnote.

thoughts below.

diff --git a/src/codecs/jats/index.ts b/src/codecs/jats/index.ts index 43b0e6d2b..40064bc7f 100644 --- a/src/codecs/jats/index.ts +++ b/src/codecs/jats/index.ts @@ -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) diff --git a/src/codecs/jats/jats.test.ts b/src/codecs/jats/jats.test.ts index 3a239d72f..66f46d8f2 100644 --- a/src/codecs/jats/jats.test.ts +++ b/src/codecs/jats/jats.test.ts @@ -77,6 +77,7 @@ describe('encode: Math', () => { test.each([ 'fig.xml', 'statement.xml', + 'footnote.xml', 'quote.xml', 'elife-30274-v1', 'elife-43154-v2',