git.iko.soy/typeable/pandoc
on master help sign in
LaTeX writer: fix a use of `last` that might take empty list.
4bc2b7eJohn MacFarlane
src/Text/Pandoc/Writers/LaTeX.hs+3−3
@@ -176,9 +176,9 @@ pandocToLaTeX options (Pandoc meta blocks) = do
176 modify $ \s -> s{stCsquotes = True}
176 modify $ \s -> s{stCsquotes = True}
177 let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then
177 let (blocks'', lastHeader) = if writerCiteMethod options == Citeproc then
178 (blocks', [])
178 (blocks', [])
179− else case last blocks' of
179+ else case reverse blocks' of
180− Header 1 _ il -> (init blocks', il)
180+ Header 1 _ il : _ -> (init blocks', il)
181− _ -> (blocks', [])
181+ _ -> (blocks', [])
182 beamer <- gets stBeamer
182 beamer <- gets stBeamer
183 blocks''' <- if beamer
183 blocks''' <- if beamer
184 then toSlides blocks''
184 then toSlides blocks''