Markdown Reader: Require nonempty value in mmd title block

`many1Till` will gobble up newline, and then whole following line will
match, so I had to use guard here.
This commit is contained in:
Nikolay Yakimov 2015-03-28 07:07:03 +03:00
parent 7091002966
commit 5f7639a0d6

View file

@ -329,6 +329,7 @@ kvPair = try $ do
skipMany1 spaceNoNewline
val <- manyTill anyChar
(try $ newline >> lookAhead (blankline <|> nonspaceChar))
guard $ not . null . trim $ val
let key' = concat $ words $ map toLower key
let val' = MetaBlocks $ B.toList $ B.plain $ B.text $ trim val
return (key',val')