From 73d394ca2adff31a384404ae25665b36c7d0bba0 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 18 Apr 2021 22:01:12 -0700 Subject: Use MetaInlines not MetaBlocks for multimarkdown metadata fields. This gives better results in converting to e.g. pandoc markdown. Ref: --- src/Text/Pandoc/Readers/Markdown.hs | 2 +- test/command/mmd-metadata.md | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 test/command/mmd-metadata.md diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 6c3947a81..4b20e3a8b 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -298,7 +298,7 @@ kvPair allowEmpty = try $ do (try $ newline >> lookAhead (blankline <|> nonspaceChar)) guard $ allowEmpty || not (T.null val) let key' = T.concat $ T.words $ T.toLower key - let val' = MetaBlocks $ B.toList $ B.plain $ B.text val + let val' = MetaInlines $ B.toList $ B.text val return (key',val') parseMarkdown :: PandocMonad m => MarkdownParser m Pandoc diff --git a/test/command/mmd-metadata.md b/test/command/mmd-metadata.md new file mode 100644 index 000000000..3cda34873 --- /dev/null +++ b/test/command/mmd-metadata.md @@ -0,0 +1,20 @@ +``` +% pandoc -f markdown_mmd -t markdown -s +Title: Blah blah blah +Author: Doo de Doo +Base Header Level: 1 +Bibliography: Pubs.bib +Lang: en-GB + +body +^D +--- +author: Doo de Doo +baseheaderlevel: 1 +bibliography: Pubs.bib +lang: en-GB +title: Blah blah blah +--- + +body +``` -- cgit v1.2.3