aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Citeproc.hs26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs
index 75cbe6991..8976ae560 100644
--- a/src/Text/Pandoc/Citeproc.hs
+++ b/src/Text/Pandoc/Citeproc.hs
@@ -524,16 +524,26 @@ capitalizeNoteCitation (Cite cs [Note [Para ils]]) =
$ B.fromList ils]]
capitalizeNoteCitation x = x
-deNote :: Inline -> Inline
-deNote (Note bs) = Note $ walk go bs
+deNote :: [Inline] -> [Inline]
+deNote [] = []
+deNote (Note bs:rest) =
+ Note (walk go bs) : deNote rest
where
- go (Cite cs ils) = Cite cs (concatMap removeNote ils)
+ go (Cite (c:cs) ils)
+ | citationMode c == AuthorInText
+ = Cite cs (concatMap noteAfterComma ils)
+ | otherwise
+ = Cite cs (concatMap noteInParens ils)
go x = x
- removeNote (Note bs')
- = Space : Str "(" : (removeFinalPeriod
- (blocksToInlines bs')) ++ [Str ")"]
- removeNote x = [x]
-deNote x = x
+ noteInParens (Note bs')
+ = Space : Str "(" :
+ removeFinalPeriod (blocksToInlines bs') ++ [Str ")"]
+ noteInParens x = [x]
+ noteAfterComma (Note bs')
+ = Str "," : Space :
+ removeFinalPeriod (blocksToInlines bs')
+ noteAfterComma x = [x]
+deNote (x:xs) = x : deNote xs
-- Note: we can't use dropTextWhileEnd indiscriminately,
-- because this would remove the final period on abbreviations like Ibid.