git.iko.soy/typeable/pandoc
on master help sign in
Context and latex writers - parse title, author, date before body.
2a9ac1efiddlosopher
src/Text/Pandoc/Writers/ConTeXt.hs+7−7
@@ -57,6 +57,13 @@ writeConTeXt options document =
57
57
58pandocToConTeXt :: WriterOptions -> Pandoc -> State WriterState String
58pandocToConTeXt :: WriterOptions -> Pandoc -> State WriterState String
59pandocToConTeXt options (Pandoc (Meta title authors date) blocks) = do
59pandocToConTeXt options (Pandoc (Meta title authors date) blocks) = do
60+ titletext <- if null title
61+ then return ""
62+ else liftM render $ inlineListToConTeXt title
63+ authorstext <- mapM (liftM render . inlineListToConTeXt) authors
64+ datetext <- if null date
65+ then return ""
66+ else liftM render $ inlineListToConTeXt date
60 body <- blockListToConTeXt blocks
67 body <- blockListToConTeXt blocks
61 let before = if null (writerIncludeBefore options)
68 let before = if null (writerIncludeBefore options)
62 then empty
69 then empty
@@ -65,13 +72,6 @@ pandocToConTeXt options (Pandoc (Meta title authors date) blocks) = do
65 then empty
72 then empty
66 else text $ writerIncludeAfter options
73 else text $ writerIncludeAfter options
67 let main = render $ before $$ body $$ after
74 let main = render $ before $$ body $$ after
68− titletext <- if null title
69− then return ""
70− else liftM render $ inlineListToConTeXt title
71− authorstext <- mapM (liftM render . inlineListToConTeXt) authors
72− datetext <- if null date
73− then return ""
74− else liftM render $ inlineListToConTeXt date
75 let context = writerVariables options ++
75 let context = writerVariables options ++
76 [ ("toc", if writerTableOfContents options then "yes" else "")
76 [ ("toc", if writerTableOfContents options then "yes" else "")
77 , ("body", main)
77 , ("body", main)
src/Text/Pandoc/Writers/LaTeX.hs+3−3
@@ -52,6 +52,9 @@ writeLaTeX options document =
52
52
53pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String
53pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String
54pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
54pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
55+ titletext <- liftM render $ inlineListToLaTeX title
56+ authorsText <- mapM (liftM render . inlineListToLaTeX) authors
57+ dateText <- liftM render $ inlineListToLaTeX date
55 body <- blockListToLaTeX blocks
58 body <- blockListToLaTeX blocks
56 let before = if null (writerIncludeBefore options)
59 let before = if null (writerIncludeBefore options)
57 then empty
60 then empty
@@ -60,9 +63,6 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do
60 then empty
63 then empty
61 else text $ writerIncludeAfter options
64 else text $ writerIncludeAfter options
62 let main = render $ before $$ body $$ after
65 let main = render $ before $$ body $$ after
63− titletext <- liftM render $ inlineListToLaTeX title
64− authorsText <- mapM (liftM render . inlineListToLaTeX) authors
65− dateText <- liftM render $ inlineListToLaTeX date
66 let context = writerVariables options ++
66 let context = writerVariables options ++
67 [ ("toc", if writerTableOfContents options then "yes" else "")
67 [ ("toc", if writerTableOfContents options then "yes" else "")
68 , ("body", main)
68 , ("body", main)