aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/JATS.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-02-15 10:09:46 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2019-02-15 10:09:46 -0800
commit35df24e698d93d8e9a39099184e62ac0c16770a9 (patch)
treed4837a94222ec2b5ea74ec0b153056b1792f4315 /src/Text/Pandoc/Readers/JATS.hs
parentb6c64bdd81520529ad11a18011351594892a820d (diff)
downloadpandoc-35df24e698d93d8e9a39099184e62ac0c16770a9.tar.gz
JATS reader: handle citations with multiple references.
The rid attribute can have a space-separated list of ids. Closes #5310.
Diffstat (limited to 'src/Text/Pandoc/Readers/JATS.hs')
-rw-r--r--src/Text/Pandoc/Readers/JATS.hs17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs
index 232bf8b96..52a18347c 100644
--- a/src/Text/Pandoc/Readers/JATS.hs
+++ b/src/Text/Pandoc/Readers/JATS.hs
@@ -470,16 +470,19 @@ parseInline (Elem e) =
"xref" -> do
ils <- innerInlines
let rid = attrValue "rid" e
+ let rids = words rid
let refType = ("ref-type",) <$> maybeAttrValue "ref-type" e
let attr = (attrValue "id" e, [], maybeToList refType)
return $ if refType == Just ("ref-type","bibr")
- then cite [Citation{
- citationId = rid
- , citationPrefix = []
- , citationSuffix = []
- , citationMode = NormalCitation
- , citationNoteNum = 0
- , citationHash = 0}] ils
+ then cite
+ (map (\id' ->
+ Citation{ citationId = id'
+ , citationPrefix = []
+ , citationSuffix = []
+ , citationMode = NormalCitation
+ , citationNoteNum = 0
+ , citationHash = 0}) rids)
+ ils
else linkWith attr ('#' : rid) "" ils
"ext-link" -> do
ils <- innerInlines