Use $for$ for multiple authors in context, latex, markdown.

git-svn-id: https://pandoc.googlecode.com/svn/trunk@1723 788f1e2b-df1e-0410-8736-df70ead52e1b
This commit is contained in:
fiddlosopher 2009-12-31 01:16:00 +00:00
parent fbef848a3a
commit dd210437f6
6 changed files with 11 additions and 16 deletions

View file

@ -76,8 +76,8 @@ pandocToConTeXt options (Pandoc (Meta title authors date) blocks) = do
[ ("toc", if writerTableOfContents options then "yes" else "")
, ("body", main)
, ("title", titletext)
, ("authors", intercalate "\\\\" authorstext)
, ("date", datetext) ]
, ("date", datetext) ] ++
[ ("author", a) | a <- authorstext ]
return $ if writerStandalone options
then renderTemplate context $ writerTemplate options
else main

View file

@ -32,7 +32,7 @@ import Text.Pandoc.Definition
import Text.Pandoc.Shared
import Text.Pandoc.Templates
import Text.Printf ( printf )
import Data.List ( (\\), isSuffixOf, intercalate, intersperse )
import Data.List ( (\\), isSuffixOf, intersperse )
import Data.Char ( toLower )
import Control.Monad.State
import Control.Monad (liftM)
@ -67,8 +67,8 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
[ ("toc", if writerTableOfContents options then "yes" else "")
, ("body", main)
, ("title", titletext)
, ("authors", intercalate "\\\\" authorsText)
, ("date", dateText) ]
, ("date", dateText) ] ++
[ ("author", a) | a <- authorsText ]
return $ if writerStandalone options
then renderTemplate context $ writerTemplate options
else main

View file

@ -52,8 +52,7 @@ writeMarkdown opts document =
pandocToMarkdown :: WriterOptions -> Pandoc -> State WriterState String
pandocToMarkdown opts (Pandoc (Meta title authors date) blocks) = do
title' <- inlineListToMarkdown opts title
authors' <- liftM (hcat . intersperse (text "; ")) $
mapM (inlineListToMarkdown opts) authors
authors' <- mapM (inlineListToMarkdown opts) authors
date' <- inlineListToMarkdown opts date
let titleblock = not $ null title && null authors && null date
let headerBlocks = filter isHeaderBlock blocks
@ -76,10 +75,10 @@ pandocToMarkdown opts (Pandoc (Meta title authors date) blocks) = do
[ ("toc", render toc)
, ("body", main)
, ("title", render title')
, ("authors", render authors')
, ("date", render date')
] ++
[ ("titleblock", "yes") | titleblock ]
[ ("titleblock", "yes") | titleblock ] ++
[ ("author", render a) | a <- authors' ]
if writerStandalone opts
then return $ renderTemplate context $ writerTemplate opts
else return main

View file

@ -78,9 +78,7 @@ $endfor$
$if(title)$
\doctitle{$title$}
$endif$
$if(authors)$
\author{$authors$}
$endif$
\author{$for(author)$$author$$sep$\\$endfor$}
$if(date)$
\date{$date$}
$endif$

View file

@ -38,9 +38,7 @@ $endfor$
$if(title)$
\title{$title$}
$endif$
$if(authors)$
\author{$authors$}
$endif$
\author{$for(author)$$author$$sep$\\$endfor$}
$if(date)$
\date{$date$}
$endif$

View file

@ -1,6 +1,6 @@
$if(titleblock)$
% $title$
% $authors$
% $for(author)$$author$$sep$; $endfor$
% $date$
$endif$