diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-08-13 19:19:43 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-08-13 19:25:29 -0700 |
commit | 82638ad53bb47acde835083390f8211ac21cda6c (patch) | |
tree | fb45f6ba642cd059e7b2a3e54dfe93aa61071f84 | |
parent | 15683bb607eb924816adcb7e7884fe722d3d3129 (diff) | |
download | pandoc-82638ad53bb47acde835083390f8211ac21cda6c.tar.gz |
Convert Quoted in bib entries to special Spans...
before passing them off to citeproc.
This ensures that we get proper localization and flipflopping
if, e.g., quotes are used in titles.
Closes jgm/citeproc#87.
-rw-r--r-- | pandoc.cabal | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Citeproc.hs | 4 | ||||
-rw-r--r-- | stack.yaml | 1 | ||||
-rw-r--r-- | test/command/citeproc-87.md | 42 |
4 files changed, 47 insertions, 2 deletions
diff --git a/pandoc.cabal b/pandoc.cabal index bc8ea2588..f4a173f59 100644 --- a/pandoc.cabal +++ b/pandoc.cabal @@ -492,7 +492,7 @@ library syb >= 0.1 && < 0.8, tagsoup >= 0.14.6 && < 0.15, temporary >= 1.1 && < 1.4, - texmath >= 0.12.3 && < 0.12.4, + texmath >= 0.12.3.1 && < 0.12.4, text >= 1.1.1.0 && < 1.3, text-conversions >= 0.3 && < 0.4, time >= 1.5 && < 1.12, diff --git a/src/Text/Pandoc/Citeproc.hs b/src/Text/Pandoc/Citeproc.hs index 0f007f336..39760776d 100644 --- a/src/Text/Pandoc/Citeproc.hs +++ b/src/Text/Pandoc/Citeproc.hs @@ -208,7 +208,9 @@ getReferences mblocale (Pandoc meta bs) = do Just fp -> getRefsFromBib locale idpred fp Nothing -> return [] Nothing -> return [] - return $ map (linkifyVariables . legacyDateRanges) + let addQuoteSpan (Quoted _ xs) = Span ("",["csl-quoted"],[]) xs + addQuoteSpan x = x + return $ map (linkifyVariables . legacyDateRanges . walk addQuoteSpan) (externalRefs ++ inlineRefs) -- note that inlineRefs can override externalRefs diff --git a/stack.yaml b/stack.yaml index ef92855c1..ce58cf732 100644 --- a/stack.yaml +++ b/stack.yaml @@ -12,6 +12,7 @@ extra-deps: - skylighting-core-0.11 - skylighting-0.11 - doctemplates-0.10 +- texmath-0.12.3.1 # - citeproc-0.4.1 - git: https://github.com/jgm/citeproc.git commit: 8d03cb722fac3ea8f17f432ac20abe35361df551 diff --git a/test/command/citeproc-87.md b/test/command/citeproc-87.md index 42cf7a6ee..4faa6bfba 100644 --- a/test/command/citeproc-87.md +++ b/test/command/citeproc-87.md @@ -14,3 +14,45 @@ references: ^D Foo (Aristotele, s.d., 50: «Disse: "bar"»). «Disse: "baz"» ``` + +For en, the localized quotes match what Quoted would produce, +so the Quoted is passed to citeproc as a Span ("",["csl-quoted"],[]) +and flipflopping and localization occur. +``` +% pandoc -C -t plain -Mlang=en +--- +references: +- id: a + author: + - literal: Aristotele + title: Metafisica et "Physica" + type: article-journal +... + +Foo [@a 50]. +^D +Foo (Aristotele, n.d., 50). + +Aristotele. n.d. “Metafisica Et ‘Physica’.” +``` + +For cs, there is no such match, so the Quoted is left alone +and has the same effect it would have elsewhere in a pandoc document. +``` +% pandoc -C -t plain -Mlang=it +--- +references: +- id: a + author: + - literal: Aristotele + title: Metafisica et "Physica" + type: article-journal +... + +Foo [@a 50]. +^D +Foo (Aristotele, s.d., 50). + +Aristotele. s.d. «Metafisica et “Physica”». +``` + |