diff options
Diffstat (limited to 'src/Hakyll/Web/Template/Internal.hs')
-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 <$> |