aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2020-04-11 10:40:59 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2020-04-11 10:40:59 -0700
commit9187b4bca9fc42ad7ca865d1e691664a463c8924 (patch)
treee20f1c8d713caf6322249788306b2bcc9ec27480 /src/Text/Pandoc
parentdd06d6354081f478e99d864ac4343896ec887eda (diff)
downloadpandoc-9187b4bca9fc42ad7ca865d1e691664a463c8924.tar.gz
LaTeX writer: ensure that `-M csquotes` works even in fragment mode.
Closes #6265.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 37fa72c27..1670f8380 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -155,7 +155,8 @@ pandocToLaTeX options (Pandoc meta blocks) = do
_ -> "article"
when (documentClass `elem` chaptersClasses) $
modify $ \s -> s{ stHasChapters = True }
- case T.toLower . render Nothing <$> getField "csquotes" metadata of
+ case lookupContext "csquotes" (writerVariables options) `mplus`
+ (stringify <$> lookupMeta "csquotes" meta) of
Nothing -> return ()
Just "false" -> return ()
Just _ -> modify $ \s -> s{stCsquotes = True}
@@ -1423,14 +1424,14 @@ type Prefix = [Inline]
type Suffix = [Inline]
type CiteId = Text
data CiteGroup = CiteGroup Prefix Suffix [CiteId]
-
+
citeArgumentsList :: PandocMonad m
=> CiteGroup -> LW m (Doc Text)
citeArgumentsList (CiteGroup _ _ []) = return empty
-citeArgumentsList (CiteGroup pfxs sfxs ids) = do
+citeArgumentsList (CiteGroup pfxs sfxs ids) = do
pdoc <- inlineListToLaTeX pfxs
- sdoc <- inlineListToLaTeX sfxs'
- return $ (optargs pdoc sdoc) <>
+ sdoc <- inlineListToLaTeX sfxs'
+ return $ (optargs pdoc sdoc) <>
(braces (literal (T.intercalate "," (reverse ids))))
where sfxs' = stripLocatorBraces $ case sfxs of
(Str t : r) -> case T.uncons t of
@@ -1479,22 +1480,22 @@ citationsToBiblatex (c:cs)
NormalCitation -> "\\autocite"
return $ text cmd <>
braces (literal (T.intercalate "," (map citationId (c:cs))))
- | otherwise
- = do
+ | otherwise
+ = do
let cmd = case citationMode c of
SuppressAuthor -> "\\autocites*"
AuthorInText -> "\\textcites"
NormalCitation -> "\\autocites"
-
+
groups <- mapM citeArgumentsList (reverse (foldl' grouper [] (c:cs)))
return $ text cmd <> (mconcat groups)
- where grouper prev cit = case prev of
+ where grouper prev cit = case prev of
((CiteGroup oPfx oSfx ids):rest)
| null oSfx && null pfx -> (CiteGroup oPfx sfx (cid:ids)):rest
_ -> (CiteGroup pfx sfx [cid]):prev
- where pfx = citationPrefix cit
+ where pfx = citationPrefix cit
sfx = citationSuffix cit
cid = citationId cit