Use MetaInlines not MetaBlocks for multimarkdown metadata fields.

This gives better results in converting to e.g. pandoc markdown.

Ref: <https://groups.google.com/d/msgid/pandoc-discuss/9728d1f4-040e-4392-aa04-148f648a8dfdn%40googlegroups.com>
This commit is contained in:
John MacFarlane 2021-04-18 22:01:12 -07:00
parent 8d584b5826
commit 73d394ca2a
2 changed files with 21 additions and 1 deletions

View file

@ -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

View file

@ -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
```