diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-09-19 10:08:49 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-09-19 10:08:49 -0700 |
commit | e135955b1e37b4bee72ffc6d7f4dc60e99dcecae (patch) | |
tree | d20eb98b86055f603b0adf23f42c4db39cf4321d /src/Text | |
parent | d27e5a6ff002d575004bdb7abaebdc9c50e02b50 (diff) | |
download | pandoc-e135955b1e37b4bee72ffc6d7f4dc60e99dcecae.tar.gz |
LaTeX writer: Don't print biblio if --natbib or --biblatex option used.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 37ca60ce3..8b05cfb43 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -82,10 +82,17 @@ writeLaTeX options document = pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String pandocToLaTeX options (Pandoc meta blocks) = do + -- Strip off final 'references' header if --natbib or --biblatex + let method = writerCiteMethod options + let blocks' = if method == Biblatex || method == Natbib + then case reverse blocks of + (Div (_,["references"],_) _):xs -> reverse xs + _ -> blocks + else blocks -- see if there are internal links let isInternalLink (Link _ ('#':xs,_)) = [xs] isInternalLink _ = [] - modify $ \s -> s{ stInternalLinks = query isInternalLink blocks } + modify $ \s -> s{ stInternalLinks = query isInternalLink blocks' } let template = writerTemplate options -- set stBook depending on documentclass let bookClasses = ["memoir","book","report","scrreprt","scrbook"] @@ -107,15 +114,15 @@ pandocToLaTeX options (Pandoc meta blocks) = do (fmap (render colwidth) . blockListToLaTeX) (fmap (render colwidth) . inlineListToLaTeX) meta - let (blocks', lastHeader) = if writerCiteMethod options == Citeproc then - (blocks, []) - else case last blocks of - Header 1 _ il -> (init blocks, il) - _ -> (blocks, []) - blocks'' <- if writerBeamer options - then toSlides blocks' - else return blocks' - body <- mapM (elementToLaTeX options) $ hierarchicalize blocks'' + let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then + (blocks', []) + else case last blocks' of + Header 1 _ il -> (init blocks', il) + _ -> (blocks', []) + blocks''' <- if writerBeamer options + then toSlides blocks'' + else return blocks'' + body <- mapM (elementToLaTeX options) $ hierarchicalize blocks''' (biblioTitle :: String) <- liftM (render colwidth) $ inlineListToLaTeX lastHeader let main = render colwidth $ vsep body st <- get |