aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-02-25 23:46:39 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-02-25 23:46:39 +0100
commit4aed13bf7c746c34d0cd4d5a3cea94f2ee9b73f8 (patch)
tree6efdecc11c81392e3c94e41ec4b3efb505614005 /src
parent124551461cb9bc46e4387dbcd8ac4ebf3eae6d22 (diff)
downloadpandoc-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.hs7
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