git.iko.soy/typeable/pandoc
on master help sign in
Use $for$ for multiple authors in context, latex, markdown.
dd21043fiddlosopher
src/Text/Pandoc/Writers/ConTeXt.hs+2−2
@@ -76,8 +76,8 @@ pandocToConTeXt options (Pandoc (Meta title authors date) blocks) = do
76 [ ("toc", if writerTableOfContents options then "yes" else "")
76 [ ("toc", if writerTableOfContents options then "yes" else "")
77 , ("body", main)
77 , ("body", main)
78 , ("title", titletext)
78 , ("title", titletext)
79− , ("authors", intercalate "\\\\" authorstext)
80− , ("date", datetext) ]
79+ , ("date", datetext) ] ++
80+ [ ("author", a) | a <- authorstext ]
81 return $ if writerStandalone options
81 return $ if writerStandalone options
82 then renderTemplate context $ writerTemplate options
82 then renderTemplate context $ writerTemplate options
83 else main
83 else main
src/Text/Pandoc/Writers/LaTeX.hs+3−3
@@ -32,7 +32,7 @@ import Text.Pandoc.Definition
32import Text.Pandoc.Shared
32import Text.Pandoc.Shared
33import Text.Pandoc.Templates
33import Text.Pandoc.Templates
34import Text.Printf ( printf )
34import Text.Printf ( printf )
35−import Data.List ( (\\), isSuffixOf, intercalate, intersperse )
35+import Data.List ( (\\), isSuffixOf, intersperse )
36import Data.Char ( toLower )
36import Data.Char ( toLower )
37import Control.Monad.State
37import Control.Monad.State
38import Control.Monad (liftM)
38import Control.Monad (liftM)
@@ -67,8 +67,8 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
67 [ ("toc", if writerTableOfContents options then "yes" else "")
67 [ ("toc", if writerTableOfContents options then "yes" else "")
68 , ("body", main)
68 , ("body", main)
69 , ("title", titletext)
69 , ("title", titletext)
70− , ("authors", intercalate "\\\\" authorsText)
71− , ("date", dateText) ]
70+ , ("date", dateText) ] ++
71+ [ ("author", a) | a <- authorsText ]
72 return $ if writerStandalone options
72 return $ if writerStandalone options
73 then renderTemplate context $ writerTemplate options
73 then renderTemplate context $ writerTemplate options
74 else main
74 else main
src/Text/Pandoc/Writers/Markdown.hs+3−4
@@ -52,8 +52,7 @@ writeMarkdown opts document =
52pandocToMarkdown :: WriterOptions -> Pandoc -> State WriterState String
52pandocToMarkdown :: WriterOptions -> Pandoc -> State WriterState String
53pandocToMarkdown opts (Pandoc (Meta title authors date) blocks) = do
53pandocToMarkdown opts (Pandoc (Meta title authors date) blocks) = do
54 title' <- inlineListToMarkdown opts title
54 title' <- inlineListToMarkdown opts title
55− authors' <- liftM (hcat . intersperse (text "; ")) $
56− mapM (inlineListToMarkdown opts) authors
55+ authors' <- mapM (inlineListToMarkdown opts) authors
57 date' <- inlineListToMarkdown opts date
56 date' <- inlineListToMarkdown opts date
58 let titleblock = not $ null title && null authors && null date
57 let titleblock = not $ null title && null authors && null date
59 let headerBlocks = filter isHeaderBlock blocks
58 let headerBlocks = filter isHeaderBlock blocks
@@ -76,10 +75,10 @@ pandocToMarkdown opts (Pandoc (Meta title authors date) blocks) = do
76 [ ("toc", render toc)
75 [ ("toc", render toc)
77 , ("body", main)
76 , ("body", main)
78 , ("title", render title')
77 , ("title", render title')
79− , ("authors", render authors')
80 , ("date", render date')
78 , ("date", render date')
81 ] ++
79 ] ++
82− [ ("titleblock", "yes") | titleblock ]
80+ [ ("titleblock", "yes") | titleblock ] ++
81+ [ ("author", render a) | a <- authors' ]
83 if writerStandalone opts
82 if writerStandalone opts
84 then return $ renderTemplate context $ writerTemplate opts
83 then return $ renderTemplate context $ writerTemplate opts
85 else return main
84 else return main
templates/context.template+1−3
@@ -78,9 +78,7 @@ $endfor$
78$if(title)$
78$if(title)$
79\doctitle{$title$}
79\doctitle{$title$}
80$endif$
80$endif$
81−$if(authors)$
81+\author{$for(author)$$author$$sep$\\$endfor$}
82−\author{$authors$}
83−$endif$
84$if(date)$
82$if(date)$
85\date{$date$}
83\date{$date$}
86$endif$
84$endif$
templates/latex.template+1−3
@@ -38,9 +38,7 @@ $endfor$
38$if(title)$
38$if(title)$
39\title{$title$}
39\title{$title$}
40$endif$
40$endif$
41−$if(authors)$
41+\author{$for(author)$$author$$sep$\\$endfor$}
42−\author{$authors$}
43−$endif$
44$if(date)$
42$if(date)$
45\date{$date$}
43\date{$date$}
46$endif$
44$endif$
templates/markdown.template+1−1
@@ -1,6 +1,6 @@
1$if(titleblock)$
1$if(titleblock)$
2% $title$
2% $title$
3−% $authors$
3+% $for(author)$$author$$sep$; $endfor$
4% $date$
4% $date$
5
5
6$endif$
6$endif$