diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-02-25 23:46:39 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-02-25 23:46:39 +0100 |
commit | 4aed13bf7c746c34d0cd4d5a3cea94f2ee9b73f8 (patch) | |
tree | 6efdecc11c81392e3c94e41ec4b3efb505614005 /src | |
parent | 124551461cb9bc46e4387dbcd8ac4ebf3eae6d22 (diff) | |
download | pandoc-4aed13bf7c746c34d0cd4d5a3cea94f2ee9b73f8.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/Markdown.hs | 7 |
1 files changed, 3 insertions, 4 deletions
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 |