Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(JATS): Don't duplicate footnote content in abstract #969

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
fix(JATS): Don't duplicate footnote content in abstract
Previously all `<p>`s would be rendered. With footnotes
a paragraph can appear nested "inside" of a paragraph.
  • Loading branch information
rgieseke committed Jul 6, 2021
commit a1c71af371dc86b210bc4a2351828bf4b04786b8
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
@@ -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)