diff options
author | Andreas Lööw <AndreasLoow@users.noreply.github.com> | 2015-10-17 22:58:09 +0200 |
---|---|---|
committer | Andreas Lööw <AndreasLoow@users.noreply.github.com> | 2015-10-17 23:04:15 +0200 |
commit | f0c47907ca1d7ee9600a574c3e007640c7700d7d (patch) | |
tree | 9a3b6032b74e1281df61af26d2074f583621acfb /src | |
parent | e08399a16b9604c1c7eb92ca9cfc8213d73892eb (diff) | |
download | pandoc-f0c47907ca1d7ee9600a574c3e007640c7700d7d.tar.gz |
Consider header files when determining whether to use csquotes.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 770a674b7..15982736c 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -38,7 +38,7 @@ import Text.Pandoc.Options import Text.Pandoc.Templates import Text.Printf ( printf ) import Network.URI ( isURI, unEscapeString ) -import Data.Aeson (object, (.=)) +import Data.Aeson ( object, (.=), FromJSON ) import Data.List ( (\\), isInfixOf, stripPrefix, intercalate, intersperse ) import Data.Char ( toLower, isPunctuation, isAscii, isLetter, isDigit, ord ) import Data.Maybe ( fromMaybe ) @@ -129,7 +129,12 @@ pandocToLaTeX options (Pandoc meta blocks) = do | otherwise -> return () -- check for \usepackage...{csquotes}; if present, we'll use -- \enquote{...} for smart quotes: - when ("{csquotes}" `isInfixOf` template) $ + let headerIncludesField :: FromJSON a => Maybe a + headerIncludesField = getField "header-includes" metadata + let headerIncludes = fromMaybe [] $ mplus + (fmap return headerIncludesField) + headerIncludesField + when (any (isInfixOf "{csquotes}") (template : headerIncludes)) $ modify $ \s -> s{stCsquotes = True} let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then (blocks', []) |