aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-08-13 18:13:06 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-08-13 18:13:06 -0700
commit15683bb607eb924816adcb7e7884fe722d3d3129 (patch)
treeb4f01f775dd9cf37fa60db812e820523776d8503
parent05640f9a21e7963de4501b85f47cc1daa203c195 (diff)
downloadpandoc-15683bb607eb924816adcb7e7884fe722d3d3129.tar.gz
Citeproc: avoid odd handling of quotes.
citeproc changes allow us to ignore Quoted elements; citeproc now uses its own method for represented quoted things, and only localizes and flipflops quotes it adds itself. See #87. The one thing left to do is to convert Quoted elements in bibliography databases (esp. titles) to `Span ("",["csl-quoted"],[])` before passing them to citeproc, IF the localized quotes for the quote type match the standard inverted commas.
-rw-r--r--cabal.project2
-rw-r--r--src/Text/Pandoc/Citeproc.hs7
-rw-r--r--stack.yaml2
-rw-r--r--test/command/citeproc-87.md16
4 files changed, 24 insertions, 3 deletions
diff --git a/cabal.project b/cabal.project
index c5090838c..401992868 100644
--- a/cabal.project
+++ b/cabal.project
@@ -5,4 +5,4 @@ flags: +embed_data_files
source-repository-package
type: git
location: https://github.com/jgm/citeproc.git
- tag: 8b190eceb0cbbbf2d436bab9a5891a31be0c9865
+ tag: 8d03cb722fac3ea8f17f432ac20abe35361df551
diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs
index bfd108655..0f007f336 100644
--- a/src/Text/Pandoc/Citeproc.hs
+++ b/src/Text/Pandoc/Citeproc.hs
@@ -103,10 +103,15 @@ processCitations (Pandoc meta bs) = do
else id) .
evalState (walkM insertResolvedCitations $ Pandoc meta' bs)
$ cits
- return $ Pandoc meta''
+ return $ walk removeQuoteSpan
+ $ Pandoc meta''
$ insertRefs refkvs classes meta''
(walk fixLinks $ B.toList bibs) bs'
+removeQuoteSpan :: Inline -> Inline
+removeQuoteSpan (Span ("",["csl-quoted"],[]) xs) = Span nullAttr xs
+removeQuoteSpan x = x
+
-- | Retrieve the CSL style specified by the csl or citation-style
-- metadata field in a pandoc document, or the default CSL style
-- if none is specified. Retrieve the parent style
diff --git a/stack.yaml b/stack.yaml
index 1bad8cc59..ef92855c1 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -14,7 +14,7 @@ extra-deps:
- doctemplates-0.10
# - citeproc-0.4.1
- git: https://github.com/jgm/citeproc.git
- commit: 8b190eceb0cbbbf2d436bab9a5891a31be0c9865
+ commit: 8d03cb722fac3ea8f17f432ac20abe35361df551
ghc-options:
"$locals": -fhide-source-paths -Wno-missing-home-modules
resolver: lts-18.0
diff --git a/test/command/citeproc-87.md b/test/command/citeproc-87.md
new file mode 100644
index 000000000..42cf7a6ee
--- /dev/null
+++ b/test/command/citeproc-87.md
@@ -0,0 +1,16 @@
+```
+% pandoc --citeproc -Mlang=it-IT -t markdown-citations
+Foo [@a 50: «Disse: "bar"»]. «Disse: "baz"»
+
+---
+suppress-bibliography: true
+references:
+- id: a
+ author:
+ - literal: Aristotele
+ title: Metafisica
+ type: book
+...
+^D
+Foo (Aristotele, s.d., 50: «Disse: "bar"»). «Disse: "baz"»
+```