From a1f010de7830777b86f88743785560a04fab62fd Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 29 Jun 2013 22:14:01 -0700 Subject: Metadata changes: Variables now completely shadow metadata. Previously if you set a value both in metadata and with a variable, they'd be combined into a list. Now the variable replaces the value in document metadata. If many variables with the same name are set, a list is created. Shared: metaToJSON now has an argument for a variable list. --- src/Text/Pandoc/Writers/OpenDocument.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Text/Pandoc/Writers/OpenDocument.hs') diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index ff405355f..b9c99d536 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -42,7 +42,7 @@ import Control.Arrow ( (***), (>>>) ) import Control.Monad.State hiding ( when ) import Data.Char (chr, isDigit) import qualified Data.Map as Map -import Text.Pandoc.Shared (metaToJSON, defField, setField) +import Text.Pandoc.Shared (metaToJSON, defField) -- | Auxiliary function to convert Plain block to Para. plainToPara :: Block -> Block @@ -183,6 +183,7 @@ writeOpenDocument opts (Pandoc meta blocks) = m <- metaToJSON (fmap (render colwidth) . blocksToOpenDocument opts) (fmap (render colwidth) . inlinesToOpenDocument opts) + (writerVariables opts) meta b <- render' `fmap` blocksToOpenDocument opts blocks return (b, m) @@ -194,8 +195,7 @@ writeOpenDocument opts (Pandoc meta blocks) = reverse $ styles ++ listStyles context = defField "body" body $ defField "automatic-styles" (render' automaticStyles) - $ foldl (\acc (x,y) -> setField x y acc) - metadata (writerVariables opts) + $ metadata in if writerStandalone opts then renderTemplate' (writerTemplate opts) context else body -- cgit v1.2.3