From 3e6d009c6b33f25dea2ff1cb13298dfa3ec0bddd Mon Sep 17 00:00:00 2001 From: John MacFarlane <jgm@berkeley.edu> Date: Thu, 29 Oct 2020 21:53:02 -0700 Subject: [PATCH] Use new citeproc; do note capitalization here, not in citeproc. --- cabal.project | 2 +- src/Text/Pandoc/Citeproc.hs | 13 +++++++++++-- stack.yaml | 2 +- ...pandoc-citeproc-chicago-fullnote-bibliography.md | 2 +- test/command/pandoc-citeproc-locators-integrated.md | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/cabal.project b/cabal.project index d76e01a1f..4fcc71969 100644 --- a/cabal.project +++ b/cabal.project @@ -7,5 +7,5 @@ package pandoc source-repository-package type: git location: https://github.com/jgm/citeproc - tag: ac57c6ceb8fe6583921c5e3f3a3838401191b97c + tag: 3bff6aff18a99b710b25949d039d221f36c3a77c diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs index 1a86db569..57f676115 100644 --- a/src/Text/Pandoc/Citeproc.hs +++ b/src/Text/Pandoc/Citeproc.hs @@ -163,8 +163,10 @@ processCitations (Pandoc meta bs) = do _ -> id let Pandoc meta'' bs' = - maybe id (setMeta "nocite") metanocites $ - walk (fixQuotes . mvPunct moveNotes locale) $ walk deNote $ + maybe id (setMeta "nocite") metanocites . + walk (map capitalizeNoteCitation . + fixQuotes . mvPunct moveNotes locale) . + walk deNote . evalState (walkM insertResolvedCitations $ Pandoc meta' bs) $ cits return $ Pandoc meta'' @@ -515,6 +517,13 @@ extractText (FancyVal x) = toText x extractText (NumVal n) = T.pack (show n) extractText _ = mempty +capitalizeNoteCitation :: Inline -> Inline +capitalizeNoteCitation (Cite cs [Note [Para ils]]) = + Cite cs + [Note [Para $ B.toList $ addTextCase Nothing CapitalizeFirst + $ B.fromList ils]] +capitalizeNoteCitation x = x + deNote :: Inline -> Inline deNote (Note bs) = Note $ walk go bs where diff --git a/stack.yaml b/stack.yaml index 30a2b6b71..2167585cb 100644 --- a/stack.yaml +++ b/stack.yaml @@ -23,7 +23,7 @@ extra-deps: - commonmark-extensions-0.2.0.1 - commonmark-pandoc-0.2.0.1 - git: https://github.com/jgm/citeproc - commit: ac57c6ceb8fe6583921c5e3f3a3838401191b97c + commit: 3bff6aff18a99b710b25949d039d221f36c3a77c ghc-options: "$locals": -fhide-source-paths -Wno-missing-home-modules diff --git a/test/command/pandoc-citeproc-chicago-fullnote-bibliography.md b/test/command/pandoc-citeproc-chicago-fullnote-bibliography.md index 567e6e4f0..71f6c47c7 100644 --- a/test/command/pandoc-citeproc-chicago-fullnote-bibliography.md +++ b/test/command/pandoc-citeproc-chicago-fullnote-bibliography.md @@ -123,7 +123,7 @@ Sam Smith. Oxford: Oxford University Press, 2007. [^9]: See [Doe, *First Book*, 2005, 34--35](#ref-item1). -[^10]: Some citations (See [Doe, chap. 3](#ref-item1); [Doe and Roe, +[^10]: Some citations (see [Doe, chap. 3](#ref-item1); [Doe and Roe, "Why Water Is Wet"](#ref-пункт3); [Doe, "Article," 2006](#ref-item2)). diff --git a/test/command/pandoc-citeproc-locators-integrated.md b/test/command/pandoc-citeproc-locators-integrated.md index 64490e376..de37cf855 100644 --- a/test/command/pandoc-citeproc-locators-integrated.md +++ b/test/command/pandoc-citeproc-locators-integrated.md @@ -29,7 +29,7 @@ See <https://github.com/jgm/pandoc-citeproc/pull/362>. [@citekey, p. \[89\]] -[@citekey and nothing else]. +[@citekey and nothing else] [@citekey, 123(4)\[5\]6, and suffix] @@ -79,7 +79,7 @@ See <https://github.com/jgm/pandoc-citeproc/pull/362>. [^9] -.[^10] +[^10] [^11]