git.iko.soy/typeable/pandoc
on master help sign in
Citeproc: use comma for in-text citations inside footnotes.

When an author-in-text citation like `@foo` occurs in a footnote, we now render it with: `AUTHOR NAME + COMMA + SPACE + REST`. Previously we rendered: `AUTHOR NAME + SPACE + "(" + REST + ")"`. This gives better results. Note that normal citations are still rendered in parentheses.

commit6051c751cef3cec46253bdb4a615d0ee3944f01f authorJohn MacFarlane <jgm@berkeley.edu> dateSun 1 Nov 2020, 10:37 (6 years ago) parent01f2d81
2 files changed+19−9
src/Text/Pandoc/Citeproc.hs+18−8 test/command/pandoc-citeproc-chicago-fullnote-bibliography.md+1−1
src/Text/Pandoc/Citeproc.hs+18−8
@@ -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.
test/command/pandoc-citeproc-chicago-fullnote-bibliography.md+1−1
@@ -114,7 +114,7 @@ Sam Smith. Oxford: Oxford University Press, 2007.
114114 Roe, "Why Water Is Wet," in *Third Book*, ed. Sam Smith (Oxford:
115115 Oxford University Press, 2007)](#ref-пункт3).
116116
117−[^7]: [Doe and Roe](#ref-пункт3) (["Why Water Is Wet," 12](#ref-пункт3))
117+[^7]: [Doe and Roe](#ref-пункт3), ["Why Water Is Wet," 12](#ref-пункт3)
118118 and a citation without locators ([Doe and Roe, "Why Water Is
119119 Wet"](#ref-пункт3)).
120120