diff options
author | Lorenzo <lortabac@gmx.com> | 2016-07-23 12:31:03 +0200 |
---|---|---|
committer | Lorenzo <lortabac@gmx.com> | 2016-07-23 12:31:03 +0200 |
commit | 871cfd36ddd143f8fad14657e1c1fd80a9e6c66f (patch) | |
tree | c568158087c7f663500842d5ab001a23f0032faf /src/Hakyll/Web/Template | |
parent | 7a1989d288ac9f2e0d38e8f84509895c33780046 (diff) | |
download | hakyll-871cfd36ddd143f8fad14657e1c1fd80a9e6c66f.tar.gz |
Include file name in error messages
Diffstat (limited to 'src/Hakyll/Web/Template')
-rw-r--r-- | src/Hakyll/Web/Template/Internal.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Hakyll/Web/Template/Internal.hs b/src/Hakyll/Web/Template/Internal.hs index aa8e080..a63c40d 100644 --- a/src/Hakyll/Web/Template/Internal.hs +++ b/src/Hakyll/Web/Template/Internal.hs @@ -8,6 +8,7 @@ module Hakyll.Web.Template.Internal , TemplateExpr (..) , TemplateElement (..) , readTemplate + , readTemplateFile ) where @@ -120,10 +121,16 @@ instance Binary TemplateExpr where -------------------------------------------------------------------------------- readTemplate :: String -> Template -readTemplate input = case P.parse topLevelTemplate "" input of +readTemplate = readTemplateFile "{literal}" + + +-------------------------------------------------------------------------------- +readTemplateFile :: FilePath -> String -> Template +readTemplateFile file input = case P.parse topLevelTemplate file input of Left err -> error $ "Cannot parse template: " ++ show err Right t -> t + -------------------------------------------------------------------------------- topLevelTemplate :: P.Parser Template topLevelTemplate = Template <$> |