From 4aed13bf7c746c34d0cd4d5a3cea94f2ee9b73f8 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sat, 25 Feb 2017 23:46:39 +0100 Subject: Markdown writer: don't include variables in metadata blocks! Previously variables set on the command line were included in e.g. YAML metadata, contrary to documentation and intentions. --- src/Text/Pandoc/Writers/Markdown.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/Markdown.hs b/src/Text/Pandoc/Writers/Markdown.hs index a97c32542..2cf64537f 100644 --- a/src/Text/Pandoc/Writers/Markdown.hs +++ b/src/Text/Pandoc/Writers/Markdown.hs @@ -159,8 +159,7 @@ jsonToYaml (Object hashmap) = | otherwise -> (k' <> ":") $$ x (k', Object _, x) -> (k' <> ":") $$ nest 2 x (_, String "", _) -> empty - (k', _, x) | k == "meta-json" -> empty - | otherwise -> k' <> ":" <> space <> hang 2 "" x) + (k', _, x) -> k' <> ":" <> space <> hang 2 "" x) $ sortBy (comparing fst) $ H.toList hashmap jsonToYaml (Array vec) = vcat $ map (\v -> hang 2 "- " (jsonToYaml v)) $ V.toList vec @@ -181,7 +180,7 @@ pandocToMarkdown opts (Pandoc meta blocks) = do then Just $ writerColumns opts else Nothing isPlain <- asks envPlain - metadata <- metaToJSON opts + metadata <- metaToJSON' (fmap (render colwidth) . blockListToMarkdown opts) (fmap (render colwidth) . inlineListToMarkdown opts) meta @@ -219,7 +218,7 @@ pandocToMarkdown opts (Pandoc meta blocks) = do $ (if isNullMeta meta then id else defField "titleblock" (render' titleblock)) - $ metadata + $ addVariablesToJSON opts metadata case writerTemplate opts of Nothing -> return main Just tpl -> return $ renderTemplate' tpl context -- cgit v1.2.3