Fixed YAML metadata with "chomp" (`|-`).
Previously if a YAML block under `|-` contained
a blank line, pandoc would not parse it as metadata.
commitfb5ba1bb00a0d328db568952925f543b2bd8b584
authorJohn MacFarlane <jgm@berkeley.edu>
dateSat 11 Nov 2017, 10:17 (9 years ago)
parentf501ad0
src/Text/Pandoc/Readers/Markdown.hs+2−2
@@ -290,8 +290,8 @@ toMetaValue :: PandocMonad m
290290toMetaValue x =
291291 parseFromString' parser' (T.unpack x)
292292 where parser' = (asInlines <$> ((trimInlinesF . mconcat)
293− <$> (guard (not endsWithNewline)
294− *> manyTill inline eof)))
293+ <$> try (guard (not endsWithNewline)
294+ *> manyTill inline eof)))
295295 <|> (asBlocks <$> parseBlocks)
296296 asBlocks p = do
297297 p' <- p
test/command/yaml-with-chomp.mdnew file+12
@@ -0,0 +1,12 @@
1+```
2+% pandoc -s -t native
3+---
4+ml: |-
5+ TEST
6+
7+ BLOCK
8+...
9+^D
10+Pandoc (Meta {unMeta = fromList [("ml",MetaBlocks [Para [Str "TEST"],Plain [Str "BLOCK"]])]})
11+[]
12+```