diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-03-26 21:43:59 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-03-26 21:43:59 -0700 |
commit | 542272a52acc9c5e051b0e7336ab97572f60b461 (patch) | |
tree | 165cb405a1f053e1abdabbf58bdef6749708801e /src/Text/Pandoc | |
parent | 30a50997839a93f81854e1bff87ab9c7cff60533 (diff) | |
download | pandoc-542272a52acc9c5e051b0e7336ab97572f60b461.tar.gz |
JATS writer: Ensure that plain strings go inside `<pub-id>` tag.
See #5397.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/JATS.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/JATS.hs b/src/Text/Pandoc/Writers/JATS.hs index ac438a9ff..6cbe35bdc 100644 --- a/src/Text/Pandoc/Writers/JATS.hs +++ b/src/Text/Pandoc/Writers/JATS.hs @@ -319,7 +319,15 @@ tableItemToJATS opts isHeader item = -- | Convert a list of inline elements to JATS. inlinesToJATS :: PandocMonad m => WriterOptions -> [Inline] -> JATS m Doc -inlinesToJATS opts lst = hcat <$> mapM (inlineToJATS opts) lst +inlinesToJATS opts lst = hcat <$> mapM (inlineToJATS opts) (fixCitations lst) + where + fixCitations [] = [] + fixCitations (x@(RawInline (Format "jats") "<pub-id pub-id-type=\"doi\">") : xs) = + let isRawInline (RawInline{}) = True + isRawInline _ = False + (ys,zs) = break isRawInline xs + in x : Str (stringify ys) : fixCitations zs + fixCitations (x:xs) = x : fixCitations xs -- | Convert an inline element to JATS. inlineToJATS :: PandocMonad m => WriterOptions -> Inline -> JATS m Doc |