Fixed YAML metadata with "chomp" (|-).

Previously if a YAML block under `|-` contained
a blank line, pandoc would not parse it as metadata.
This commit is contained in:
John MacFarlane 2017-11-11 10:17:53 -05:00
parent f501ad031d
commit fb5ba1bb00
2 changed files with 14 additions and 2 deletions

View file

@ -290,8 +290,8 @@ toMetaValue :: PandocMonad m
toMetaValue x =
parseFromString' parser' (T.unpack x)
where parser' = (asInlines <$> ((trimInlinesF . mconcat)
<$> (guard (not endsWithNewline)
*> manyTill inline eof)))
<$> try (guard (not endsWithNewline)
*> manyTill inline eof)))
<|> (asBlocks <$> parseBlocks)
asBlocks p = do
p' <- p

View file

@ -0,0 +1,12 @@
```
% pandoc -s -t native
---
ml: |-
TEST
BLOCK
...
^D
Pandoc (Meta {unMeta = fromList [("ml",MetaBlocks [Para [Str "TEST"],Plain [Str "BLOCK"]])]})
[]
```