git.iko.soy/typeable/pandoc
on master help sign in
LaTeX reader & writer: Use \and to separate authors.

Closes #279.

commit6c029621ed9399abebbfd4fc43af0dd751c621aa authorJohn MacFarlane <jgm@berkeley.edu> dateThu 21 Jul 2011, 10:09 (15 years ago) parentbd18a80
3 files changed+6−4
src/Text/Pandoc/Readers/LaTeX.hs+4−2 tests/latex-reader.latex+1−1 tests/writer.latex+1−1
src/Text/Pandoc/Readers/LaTeX.hs+4−2
@@ -407,8 +407,10 @@ title = try $ do
407407authors :: GenParser Char ParserState Block
408408authors = try $ do
409409 string "\\author{"
410− raw <- many1 (notFollowedBy (char '}') >> inline)
411− let authors' = map normalizeSpaces $ splitBy (== LineBreak) raw
410+ let andsep = try $ string "\\and" >> notFollowedBy letter >>
411+ spaces >> return '&'
412+ raw <- sepBy (many $ notFollowedBy (char '}' <|> andsep) >> inline) andsep
413+ let authors' = map normalizeSpaces raw
412414 char '}'
413415 spaces
414416 updateState (\s -> s { stateAuthors = authors' })
tests/latex-reader.latex+1−1
@@ -17,7 +17,7 @@
1717\setcounter{secnumdepth}{0}
1818\VerbatimFootnotes % allows verbatim text in footnotes
1919\title{Pandoc Test Suite}
20−\author{John MacFarlane\\Anonymous}
20+\author{John MacFarlane \and Anonymous}
2121\date{July 17, 2006}
2222\begin{document}
2323\maketitle
tests/writer.latex+1−1
@@ -32,7 +32,7 @@
3232\VerbatimFootnotes % allows verbatim text in footnotes
3333
3434\title{Pandoc Test Suite}
35−\author{John MacFarlane\\Anonymous}
35+\author{John MacFarlane \and Anonymous}
3636\date{July 17, 2006}
3737
3838\begin{document}