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.
This commit is contained in:
John MacFarlane
2020-11-01 10:48:47 -08:00
parent 01f2d81168
commit 6051c751ce
2 changed files with 19 additions and 9 deletions
+18 -8
View File
@@ -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.
@@ -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)).