@@ -524,16 +524,26 @@ capitalizeNoteCitation (Cite cs [Note [Para ils]]) =
524524 $ B.fromList ils]]
525525capitalizeNoteCitation x = x
526526
527−deNote :: Inline -> Inline
528−deNote (Note bs) = Note $ walk go bs
527+deNote :: [Inline] -> [Inline]
528+deNote [] = []
529+deNote (Note bs:rest) =
530+ Note (walk go bs) : deNote rest
529531 where
530− go (Cite cs ils) = Cite cs (concatMap removeNote ils)
532+ go (Cite (c:cs) ils)
533+ | citationMode c == AuthorInText
534+ = Cite cs (concatMap noteAfterComma ils)
535+ | otherwise
536+ = Cite cs (concatMap noteInParens ils)
531537 go x = x
532− removeNote (Note bs')
533− = Space : Str "(" : (removeFinalPeriod
534− (blocksToInlines bs')) ++ [Str ")"]
535− removeNote x = [x]
536−deNote x = x
538+ noteInParens (Note bs')
539+ = Space : Str "(" :
540+ removeFinalPeriod (blocksToInlines bs') ++ [Str ")"]
541+ noteInParens x = [x]
542+ noteAfterComma (Note bs')
543+ = Str "," : Space :
544+ removeFinalPeriod (blocksToInlines bs')
545+ noteAfterComma x = [x]
546+deNote (x:xs) = x : deNote xs
537547
538548-- Note: we can't use dropTextWhileEnd indiscriminately,
539549-- because this would remove the final period on abbreviations like Ibid.