git.iko.soy/typeable/pandoc
on master help sign in
Merge branch 'master' of https://github.com/AndreasLoow/pandoc into AndreasLoow-master
4c103f6John MacFarlane
README+7−6
@@ -184,10 +184,10 @@ document contains images), [`hyperref`], [`ulem`],
184[`mathspec`], [`polyglossia`] (with `lang`), [`xecjk`], and
184[`mathspec`], [`polyglossia`] (with `lang`), [`xecjk`], and
185[`bidi`] (with the `dir` variable set). The [`upquote`] and
185[`bidi`] (with the `dir` variable set). The [`upquote`] and
186[`microtype`] packages are used if available, and [`csquotes`] will
186[`microtype`] packages are used if available, and [`csquotes`] will
187−be used for [smart punctuation] if added to the template. The
187+be used for [smart punctuation] if added to the template or included in
188−[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
188+any header file. The [`natbib`], [`biblatex`], [`bibtex`], and [`biber`]
189−optionally be used for [citation rendering]. These are included with
189+packages can optionally be used for [citation rendering]. These are
190−all recent versions of [TeX Live].
190+included with all recent versions of [TeX Live].
191
191
192Alternatively, pandoc can use ConTeXt to create a PDF.
192Alternatively, pandoc can use ConTeXt to create a PDF.
193To do this, specify an output file with a `.pdf` extension,
193To do this, specify an output file with a `.pdf` extension,
@@ -2473,8 +2473,9 @@ correct output, converting straight quotes to curly quotes, `---` to
2473em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces
2473em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces
2474are inserted after certain abbreviations, such as "Mr."
2474are inserted after certain abbreviations, such as "Mr."
2475
2475
2476−Note: if your LaTeX template calls for the [`csquotes`] package, pandoc will
2476+Note: if your LaTeX template or any included header file call for the
2477+[`csquotes`] package, pandoc will detect this automatically and use
2477−detect this automatically and use `\enquote{...}` for quoted text.
2478+`\enquote{...}` for quoted text.
2478
2479
2479Inline formatting
2480Inline formatting
2480-----------------
2481-----------------
src/Text/Pandoc/Writers/LaTeX.hs+6−1
@@ -130,7 +130,12 @@ pandocToLaTeX options (Pandoc meta blocks) = do
130 | otherwise -> return ()
130 | otherwise -> return ()
131 -- check for \usepackage...{csquotes}; if present, we'll use
131 -- check for \usepackage...{csquotes}; if present, we'll use
132 -- \enquote{...} for smart quotes:
132 -- \enquote{...} for smart quotes:
133+ let headerIncludesField :: FromJSON a => Maybe a
134+ headerIncludesField = getField "header-includes" metadata
135+ let headerIncludes = fromMaybe [] $ mplus
136+ (fmap return headerIncludesField)
137+ headerIncludesField
133− when ("{csquotes}" `isInfixOf` template) $
138+ when (any (isInfixOf "{csquotes}") (template : headerIncludes)) $
134 modify $ \s -> s{stCsquotes = True}
139 modify $ \s -> s{stCsquotes = True}
135 let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then
140 let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then
136 (blocks', [])
141 (blocks', [])