Removed quote localization from citeproc processing.

This is now done in citeproc itself.
This commit is contained in:
John MacFarlane 2021-08-13 17:29:58 -07:00
parent 418155aa95
commit 05640f9a21
3 changed files with 10 additions and 25 deletions

View file

@ -2,7 +2,7 @@ packages: pandoc.cabal
tests: True tests: True
flags: +embed_data_files flags: +embed_data_files
-- source-repository-package source-repository-package
-- type: git type: git
-- location: https://github.com/jgm/citeproc location: https://github.com/jgm/citeproc.git
-- tag: 4ce0501cd6f9c86eee087afcf878c256e49b9615 tag: 8b190eceb0cbbbf2d436bab9a5891a31be0c9865

View file

@ -88,13 +88,11 @@ processCitations (Pandoc meta bs) = do
_ -> id) $ [] _ -> id) $ []
let bibs = mconcat $ map (\(ident, out) -> let bibs = mconcat $ map (\(ident, out) ->
B.divWith ("ref-" <> ident,["csl-entry"],[]) . B.para . B.divWith ("ref-" <> ident,["csl-entry"],[]) . B.para .
walk (convertQuotes locale) .
insertSpace $ out) insertSpace $ out)
(resultBibliography result) (resultBibliography result)
let moveNotes = styleIsNoteStyle sopts && let moveNotes = styleIsNoteStyle sopts &&
maybe True truish (lookupMeta "notes-after-punctuation" meta) maybe True truish (lookupMeta "notes-after-punctuation" meta)
let cits = map (walk (convertQuotes locale)) $ let cits = resultCitations result
resultCitations result
let metanocites = lookupMeta "nocite" meta let metanocites = lookupMeta "nocite" meta
let Pandoc meta'' bs' = let Pandoc meta'' bs' =
@ -265,23 +263,6 @@ getRefs locale format idpred mbfp raw = do
(L.fromStrict raw) (L.fromStrict raw)
return $ mapMaybe metaValueToReference rs return $ mapMaybe metaValueToReference rs
-- localized quotes
convertQuotes :: Locale -> Inline -> Inline
convertQuotes locale (Quoted qt ils) =
case (M.lookup openterm terms, M.lookup closeterm terms) of
(Just ((_,oq):_), Just ((_,cq):_)) ->
Span ("",[],[]) (Str oq : ils ++ [Str cq])
_ -> Quoted qt ils
where
terms = localeTerms locale
openterm = case qt of
DoubleQuote -> "open-quote"
SingleQuote -> "open-inner-quote"
closeterm = case qt of
DoubleQuote -> "close-quote"
SingleQuote -> "close-inner-quote"
convertQuotes _ x = x
-- assumes we walk in same order as query -- assumes we walk in same order as query
insertResolvedCitations :: Inline -> State [Inlines] Inline insertResolvedCitations :: Inline -> State [Inlines] Inline
insertResolvedCitations (Cite cs ils) = do insertResolvedCitations (Cite cs ils) = do

View file

@ -12,9 +12,13 @@ extra-deps:
- skylighting-core-0.11 - skylighting-core-0.11
- skylighting-0.11 - skylighting-0.11
- doctemplates-0.10 - doctemplates-0.10
- citeproc-0.4.1 # - citeproc-0.4.1
- git: https://github.com/jgm/citeproc.git
commit: 8b190eceb0cbbbf2d436bab9a5891a31be0c9865
ghc-options: ghc-options:
"$locals": -fhide-source-paths -Wno-missing-home-modules "$locals": -fhide-source-paths -Wno-missing-home-modules
resolver: lts-18.0 resolver: lts-18.0
nix: nix:
packages: [zlib] packages: [zlib]