git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader: Handle \subtitle command.

If there's a subtitle, it is added to the title, separated by a colon and linebreak. Closes #280.

commitfe14bf9447248d4be15bfcbff88b3fab51af0a5e authorJohn MacFarlane <jgm@berkeley.edu> dateThu 21 Jul 2011, 13:33 (15 years ago) parent6c02962
1 file changed+10−1
src/Text/Pandoc/Readers/LaTeX.hs+10−1
src/Text/Pandoc/Readers/LaTeX.hs+10−1
@@ -391,7 +391,7 @@ para = do
391391--
392392
393393bibliographic :: GenParser Char ParserState Block
394−bibliographic = choice [ maketitle, title, authors, date ]
394+bibliographic = choice [ maketitle, title, subtitle, authors, date ]
395395
396396maketitle :: GenParser Char st Block
397397maketitle = try (string "\\maketitle") >> spaces >> return Null
@@ -404,6 +404,15 @@ title = try $ do
404404 updateState (\state -> state { stateTitle = tit })
405405 return Null
406406
407+subtitle :: GenParser Char ParserState Block
408+subtitle = try $ do
409+ string "\\subtitle{"
410+ tit <- manyTill inline (char '}')
411+ spaces
412+ updateState (\state -> state { stateTitle = stateTitle state ++
413+ Str ":" : LineBreak : tit })
414+ return Null
415+
407416authors :: GenParser Char ParserState Block
408417authors = try $ do
409418 string "\\author{"