diff options
author | Nathan Gass <gass@search.ch> | 2010-12-15 13:50:21 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-12-15 10:21:56 -0800 |
commit | a312d2a8aec49343ec9e8353098a2142a7c7851f (patch) | |
tree | c41a3048f868677830111381b532acd7cea4abcc /src/Text/Pandoc | |
parent | 8f60176511d006cc1c9fb8146f4e38cb9b760dc6 (diff) | |
download | pandoc-a312d2a8aec49343ec9e8353098a2142a7c7851f.tar.gz |
Use top-level header at end as bibliography title for natbib and biblatex output.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index ca7446994..1afc55f4a 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -74,15 +74,23 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do titletext <- liftM render $ inlineListToLaTeX title authorsText <- mapM (liftM render . inlineListToLaTeX) authors dateText <- liftM render $ inlineListToLaTeX date - body <- blockListToLaTeX blocks + let (blocks', lastHeader) = if writerCiteMethod options == Citeproc then + (blocks, []) + else case last blocks of + Header 1 il -> (init blocks, il) + _ -> (blocks, []) + body <- blockListToLaTeX blocks' + biblioTitle <- liftM render $ inlineListToLaTeX lastHeader let main = render body st <- get - let biblio = intercalate "," $ map dropExtension $ writerBiblioFiles options + let biblioFiles = intercalate "," $ map dropExtension $ writerBiblioFiles options citecontext = case writerCiteMethod options of - Natbib -> [ ("biblio", biblio) + Natbib -> [ ("biblio-files", biblioFiles) + , ("biblio-title", biblioTitle) , ("natbib", "yes") ] - Biblatex -> [ ("biblio", biblio) + Biblatex -> [ ("biblio-files", biblioFiles) + , ("biblio-title", biblioTitle) , ("biblatex", "yes") ] _ -> [] @@ -102,6 +110,7 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do [ ("numbersections", "yes") | writerNumberSections options ] ++ [ ("lhs", "yes") | stLHS st ] ++ [ ("graphics", "yes") | stGraphics st ] ++ + [ ("book-class", "yes") | stBook st] ++ citecontext return $ if writerStandalone options then renderTemplate context template |