git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: strip off `{}` around locator for biblatex/natbib output.

Closes #5722.

commit3fac27b26b825a36304169c698e422801605de2c authorJohn MacFarlane <jgm@berkeley.edu> dateMon 2 Sep 2019, 17:07 (7 years ago) parente9ba29e
1 file changed+7−1
src/Text/Pandoc/Writers/LaTeX.hs+7−1
src/Text/Pandoc/Writers/LaTeX.hs+7−1
@@ -1412,7 +1412,7 @@ citeCommand c p s k = do
14121412citeArguments :: PandocMonad m
14131413 => [Inline] -> [Inline] -> String -> LW m (Doc Text)
14141414citeArguments p s k = do
1415− let s' = case s of
1415+ let s' = stripLocatorBraces $ case s of
14161416 (Str
14171417 [x] : r) | isPunctuation x -> dropWhile (== Space) r
14181418 (Str (x:xs) : r) | isPunctuation x -> Str xs : r
@@ -1425,6 +1425,12 @@ citeArguments p s k = do
14251425 (_ , _ ) -> brackets pdoc <> brackets sdoc
14261426 return $ optargs <> braces (text k)
14271427
1428+-- strip off {} used to define locator in pandoc-citeproc; see #5722
1429+stripLocatorBraces :: [Inline] -> [Inline]
1430+stripLocatorBraces = walk go
1431+ where go (Str xs) = Str $ filter (\c -> c /= '{' && c /= '}') xs
1432+ go x = x
1433+
14281434citationsToBiblatex :: PandocMonad m => [Citation] -> LW m (Doc Text)
14291435citationsToBiblatex
14301436 [one]