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.
This commit is contained in:
parent
15683bb607
commit
82638ad53b
4 changed files with 47 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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”».
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue