aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-09-02 17:07:35 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-09-02 17:07:35 -0700
commit3fac27b26b825a36304169c698e422801605de2c (patch)
tree6926e57a837fa15cd2685f4a27fa7b356c8087fa /src/Text/Pandoc/Writers
parente9ba29e57f86fe6d73751665bd6f92d4ad9c0687 (diff)
downloadpandoc-3fac27b26b825a36304169c698e422801605de2c.tar.gz
LaTeX writer: strip off `{}` around locator for biblatex/natbib output.
Closes #5722.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 31494baf1..f880b0f12 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -1412,7 +1412,7 @@ citeCommand c p s k = do
citeArguments :: PandocMonad m
=> [Inline] -> [Inline] -> String -> LW m (Doc Text)
citeArguments p s k = do
- let s' = case s of
+ let s' = stripLocatorBraces $ case s of
(Str
[x] : r) | isPunctuation x -> dropWhile (== Space) r
(Str (x:xs) : r) | isPunctuation x -> Str xs : r
@@ -1425,6 +1425,12 @@ citeArguments p s k = do
(_ , _ ) -> brackets pdoc <> brackets sdoc
return $ optargs <> braces (text k)
+-- strip off {} used to define locator in pandoc-citeproc; see #5722
+stripLocatorBraces :: [Inline] -> [Inline]
+stripLocatorBraces = walk go
+ where go (Str xs) = Str $ filter (\c -> c /= '{' && c /= '}') xs
+ go x = x
+
citationsToBiblatex :: PandocMonad m => [Citation] -> LW m (Doc Text)
citationsToBiblatex
[one]