on master help sign in
Hint for weird yaml error
commit292385b7e5eb265032983f0669e5050b4fa89557 authorJasper Van der Jeugt <m@jaspervdj.be> dateWed 6 Apr 2016, 15:03 (11 years ago) parentb903bd3
1 file changed+13−2
src/Hakyll/Core/Provider/Metadata.hs+13−2
src/Hakyll/Core/Provider/Metadata.hs+13−2
@@ -1,6 +1,7 @@
11--------------------------------------------------------------------------------
22-- | Internal module to parse metadata
3−{-# LANGUAGE BangPatterns #-}
3+{-# LANGUAGE BangPatterns #-}
4+{-# LANGUAGE RecordWildCards #-}
45module Hakyll.Core.Provider.Metadata
56 ( loadMetadata
67 , parsePage
@@ -140,4 +141,14 @@ instance Exception MetadataException
140141--------------------------------------------------------------------------------
141142instance Show MetadataException where
142143 show (MetadataException fp err) =
143− fp ++ ": " ++ Yaml.prettyPrintParseException err
144+ fp ++ ": " ++ Yaml.prettyPrintParseException err ++ hint
145+
146+ where
147+ hint = case err of
148+ Yaml.InvalidYaml (Just (Yaml.YamlParseException {..}))
149+ | yamlProblem == problem -> "\n" ++
150+ "Hint: if the metadata value contains characters such\n" ++
151+ "as ':' or '-', try enclosing it in quotes."
152+ _ -> ""
153+
154+ problem = "mapping values are not allowed in this context"