From 3fac27b26b825a36304169c698e422801605de2c Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 2 Sep 2019 17:07:35 -0700 Subject: LaTeX writer: strip off `{}` around locator for biblatex/natbib output. Closes #5722. --- src/Text/Pandoc/Writers/LaTeX.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc') 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] -- cgit v1.2.3