From 815976d5378398933322006e78d140bb8de6eb80 Mon Sep 17 00:00:00 2001
From: John MacFarlane <jgm@berkeley.edu>
Date: Wed, 25 Nov 2020 09:08:51 -0800
Subject: [PATCH] Fix truncation of `[Citation]` list in `Cite` inside
 footnotes...

This affected author-in-text citations in footnotes.
It didn't cause problems for the printed output, but for
filters that expected the citation id and other information.

Closes #6890.
---
 src/Text/Pandoc/Citeproc.hs |  4 ++--
 test/command/6890.md        | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 2 deletions(-)
 create mode 100644 test/command/6890.md

diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs
index afcb2de5b..a48f97c3b 100644
--- a/src/Text/Pandoc/Citeproc.hs
+++ b/src/Text/Pandoc/Citeproc.hs
@@ -527,9 +527,9 @@ deNote (Note bs:rest) =
   go [] = []
   go (Cite (c:cs) ils : zs)
     | citationMode c == AuthorInText
-      = Cite cs (concatMap (noteAfterComma (needsPeriod zs)) ils) : go zs
+      = Cite (c:cs) (concatMap (noteAfterComma (needsPeriod zs)) ils) : go zs
     | otherwise
-      = Cite cs (concatMap noteInParens ils) : go zs
+      = Cite (c:cs) (concatMap noteInParens ils) : go zs
   go (x:xs) = x : go xs
   needsPeriod [] = True
   needsPeriod (Str t:_) = case T.uncons t of
diff --git a/test/command/6890.md b/test/command/6890.md
new file mode 100644
index 000000000..e4129e2a9
--- /dev/null
+++ b/test/command/6890.md
@@ -0,0 +1,36 @@
+```
+% pandoc -t native --citeproc
+---
+references:
+- author:
+  - family: Früchtel
+    given: Frank
+  - family: Budde
+    given: Wolfgang
+  - family: Cyprian
+    given: Gudrun
+  edition: 3
+  id: fruchtel-sozialer-2013a
+  issued: 2013
+  language: de-DE
+  publisher: Springer VS
+  publisher-place: Wiesbaden, Germany
+  title: "Sozialer Raum und Soziale Arbeit Fieldbook: Methoden und
+    Techniken"
+  title-short: Sozialer Raum und Soziale Arbeit Fieldbook
+  type: book
+---
+
+@fruchtel-sozialer-2013a
+
+Some text [^1].
+
+[^1]: @fruchtel-sozialer-2013a
+^D
+[Para [Cite [Citation {citationId = "fruchtel-sozialer-2013a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 1, citationHash = 0}] [Str "Fr\252chtel,",Space,Str "Budde,",Space,Str "and",Space,Str "Cyprian",Space,Str "(2013)"]]
+,Para [Str "Some",Space,Str "text",Str ".",Note [Para [Cite [Citation {citationId = "fruchtel-sozialer-2013a", citationPrefix = [], citationSuffix = [], citationMode = AuthorInText, citationNoteNum = 2, citationHash = 0}] [Str "Fr\252chtel,",Space,Str "Budde,",Space,Str "and",Space,Str "Cyprian",Space,Str "(2013)"]]],Str ""]
+,Div ("refs",["references","csl-bib-body","hanging-indent"],[])
+ [Div ("ref-fruchtel-sozialer-2013a",["csl-entry"],[])
+  [Para [Str "Fr\252chtel,",Space,Str "Frank,",Space,Str "Wolfgang",Space,Str "Budde,",Space,Str "and",Space,Str "Gudrun",Space,Str "Cyprian.",Space,Str "2013.",Space,Emph [Str "Sozialer",Space,Str "Raum",Space,Str "und",Space,Str "Soziale",Space,Str "Arbeit",Space,Str "Fieldbook:",Space,Str "Methoden",Space,Str "und",Space,Str "Techniken"],Str ".",Space,Str "3rd",Space,Str "ed.",Space,Str "Wiesbaden,",Space,Str "Germany:",Space,Str "Springer",Space,Str "VS."]]]]
+```
+