git.iko.soy/typeable/pandoc
on master help sign in
Fix regression with comment-only YAML metadata blocks.

Closes #7400.

commit1b07997f4a6870650f20702ed6d962f9471e3d40 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 22 Jun 2021, 09:55 (5 years ago) parent086790d
2 files changed+12
src/Text/Pandoc/Readers/Metadata.hs+3 test/command/7400.md+9
src/Text/Pandoc/Readers/Metadata.hs+3
@@ -45,6 +45,9 @@ yamlBsToMeta pMetaValue bstr = do
4545 Right [] -> return . return $ mempty
4646 Right [YAML.Doc (YAML.Scalar _ YAML.SNull)]
4747 -> return . return $ mempty
48+ -- the following is what we get from a comment:
49+ Right [YAML.Doc (YAML.Scalar _ (YAML.SUnknown _ ""))]
50+ -> return . return $ mempty
4851 Right _ -> Prelude.fail "expected YAML object"
4952 Left (yamlpos, err')
5053 -> do pos <- getPosition
test/command/7400.mdnew file+9
@@ -0,0 +1,9 @@
1+```
2+% pandoc -t native -s
3+---
4+# Comment only
5+...
6+^D
7+Pandoc (Meta {unMeta = fromList []})
8+[]
9+```