diff options
-rw-r--r-- | src/Text/Pandoc/Citeproc.hs | 26 | ||||
-rw-r--r-- | test/command/pandoc-citeproc-chicago-fullnote-bibliography.md | 2 |
2 files changed, 19 insertions, 9 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. diff --git a/test/command/pandoc-citeproc-chicago-fullnote-bibliography.md b/test/command/pandoc-citeproc-chicago-fullnote-bibliography.md index 71f6c47c7..4dfa091c0 100644 --- a/test/command/pandoc-citeproc-chicago-fullnote-bibliography.md +++ b/test/command/pandoc-citeproc-chicago-fullnote-bibliography.md @@ -114,7 +114,7 @@ Sam Smith. Oxford: Oxford University Press, 2007. Roe, "Why Water Is Wet," in *Third Book*, ed. Sam Smith (Oxford: Oxford University Press, 2007)](#ref-пункт3). -[^7]: [Doe and Roe](#ref-пункт3) (["Why Water Is Wet," 12](#ref-пункт3)) +[^7]: [Doe and Roe](#ref-пункт3), ["Why Water Is Wet," 12](#ref-пункт3) and a citation without locators ([Doe and Roe, "Why Water Is Wet"](#ref-пункт3)). |