diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-08-07 08:43:42 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-08-07 08:43:42 -0700 |
commit | d44d1664312f0d05ada61eb49a678ef8a04d90d0 (patch) | |
tree | 5879b3888937fdb38f08e9319605d0d9caaf8151 /src/Text | |
parent | 7d18770b008c12e13c324223304c6703e06f3a4a (diff) | |
download | pandoc-d44d1664312f0d05ada61eb49a678ef8a04d90d0.tar.gz |
Allow YAML title blocks to contain only comments.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index a880c09de..251554de1 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -231,7 +231,9 @@ yamlTitleBlock = try $ do pos <- getPosition string "---" blankline - rawYaml <- unlines <$> manyTill anyLine stopLine + rawYamlLines <- manyTill anyLine stopLine + -- by including --- and ..., we allow yaml blocks with just comments: + let rawYaml = unlines ("---" : (rawYamlLines ++ ["..."])) optional blanklines opts <- stateOptions <$> getState case Yaml.decodeEither' $ UTF8.fromString rawYaml of @@ -241,6 +243,7 @@ yamlTitleBlock = try $ do then f else B.setMeta (T.unpack k) (yamlToMeta opts v) . f) id hashmap + Right Yaml.Null -> return $ return id Right _ -> do addWarning (Just pos) "YAML header is not an object" return $ return id |