From 2a9ac1e65a2e1c4617a937f1c6a79f551d8637c5 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Thu, 31 Dec 2009 01:16:55 +0000 Subject: Context and latex writers - parse title, author, date before body. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1729 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Writers/ConTeXt.hs | 14 +++++++------- src/Text/Pandoc/Writers/LaTeX.hs | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs index 55105f786..776f8c6dd 100644 --- a/src/Text/Pandoc/Writers/ConTeXt.hs +++ b/src/Text/Pandoc/Writers/ConTeXt.hs @@ -57,6 +57,13 @@ writeConTeXt options document = pandocToConTeXt :: WriterOptions -> Pandoc -> State WriterState String pandocToConTeXt options (Pandoc (Meta title authors date) blocks) = do + titletext <- if null title + then return "" + else liftM render $ inlineListToConTeXt title + authorstext <- mapM (liftM render . inlineListToConTeXt) authors + datetext <- if null date + then return "" + else liftM render $ inlineListToConTeXt date body <- blockListToConTeXt blocks let before = if null (writerIncludeBefore options) then empty @@ -65,13 +72,6 @@ pandocToConTeXt options (Pandoc (Meta title authors date) blocks) = do then empty else text $ writerIncludeAfter options let main = render $ before $$ body $$ after - titletext <- if null title - then return "" - else liftM render $ inlineListToConTeXt title - authorstext <- mapM (liftM render . inlineListToConTeXt) authors - datetext <- if null date - then return "" - else liftM render $ inlineListToConTeXt date let context = writerVariables options ++ [ ("toc", if writerTableOfContents options then "yes" else "") , ("body", main) diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 412d774e9..2da632798 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -52,6 +52,9 @@ writeLaTeX options document = pandocToLaTeX :: WriterOptions -> Pandoc -> State WriterState String pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do + titletext <- liftM render $ inlineListToLaTeX title + authorsText <- mapM (liftM render . inlineListToLaTeX) authors + dateText <- liftM render $ inlineListToLaTeX date body <- blockListToLaTeX blocks let before = if null (writerIncludeBefore options) then empty @@ -60,9 +63,6 @@ pandocToLaTeX options (Pandoc (Meta title authors date) blocks) = do then empty else text $ writerIncludeAfter options let main = render $ before $$ body $$ after - titletext <- liftM render $ inlineListToLaTeX title - authorsText <- mapM (liftM render . inlineListToLaTeX) authors - dateText <- liftM render $ inlineListToLaTeX date let context = writerVariables options ++ [ ("toc", if writerTableOfContents options then "yes" else "") , ("body", main) -- cgit v1.2.3