aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Org/Inlines.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Readers/Org/Inlines.hs')
-rw-r--r--src/Text/Pandoc/Readers/Org/Inlines.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Inlines.hs b/src/Text/Pandoc/Readers/Org/Inlines.hs
index 4d901ffc4..99f71f306 100644
--- a/src/Text/Pandoc/Readers/Org/Inlines.hs
+++ b/src/Text/Pandoc/Readers/Org/Inlines.hs
@@ -182,21 +182,26 @@ adjustCiteStyle sty cs = do
addPrefixToFirstItem :: (F Inlines) -> (F [Citation]) -> (F [Citation])
addPrefixToFirstItem aff cs = do
cs' <- cs
- aff' <- aff
+ aff' <- B.toList <$> aff
case cs' of
[] -> return []
(d:ds) -> return (d{ citationPrefix =
- B.toList aff' <> citationPrefix d }:ds)
+ if null aff'
+ then citationPrefix d
+ else aff' ++ (Str "|" : citationPrefix d) }:ds)
addSuffixToLastItem :: (F Inlines) -> (F [Citation]) -> (F [Citation])
addSuffixToLastItem aff cs = do
cs' <- cs
- aff' <- aff
+ aff' <- B.toList <$> aff
case lastMay cs' of
Nothing -> return cs'
Just d ->
return (init cs' ++ [d{ citationSuffix =
- citationSuffix d <> B.toList aff' }])
+ citationSuffix d <>
+ if null aff'
+ then []
+ else Str "|" : aff' }])
citeItems :: PandocMonad m => OrgParser m (F [Citation])
citeItems = sequence <$> sepBy1' citeItem (char ';' <* void (many spaceChar))