diff options
author | samgd <sam@samgd.com> | 2016-07-22 16:39:22 +0200 |
---|---|---|
committer | samgd <sam@samgd.com> | 2016-07-22 16:39:22 +0200 |
commit | 02dd1cf2360cb2a650cb61c5e6ae2ca573eb5125 (patch) | |
tree | b218b1df2d619234355787b175c177f8c6fe507e /src | |
parent | 94cbdc1b1e1965701c7eca147c74d0c19562e1fb (diff) | |
download | hakyll-02dd1cf2360cb2a650cb61c5e6ae2ca573eb5125.tar.gz |
Add Trim_ data constructors. Add If test for Trim
Diffstat (limited to 'src')
-rw-r--r-- | src/Hakyll/Web/Template/Internal.hs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Hakyll/Web/Template/Internal.hs b/src/Hakyll/Web/Template/Internal.hs index 45db2e4..2f702f9 100644 --- a/src/Hakyll/Web/Template/Internal.hs +++ b/src/Hakyll/Web/Template/Internal.hs @@ -64,6 +64,8 @@ data TemplateElement | If TemplateExpr Template (Maybe Template) -- expr, then, else | For TemplateExpr Template (Maybe Template) -- expr, body, separator | Partial TemplateExpr -- filename + | TrimL + | TrimR deriving (Show, Eq, Typeable) @@ -71,10 +73,12 @@ data TemplateElement instance Binary TemplateElement where put (Chunk string) = putWord8 0 >> put string put (Expr e) = putWord8 1 >> put e - put (Escaped) = putWord8 2 - put (If e t f ) = putWord8 3 >> put e >> put t >> put f + put Escaped = putWord8 2 + put (If e t f) = putWord8 3 >> put e >> put t >> put f put (For e b s) = putWord8 4 >> put e >> put b >> put s put (Partial e) = putWord8 5 >> put e + put TrimL = putWord8 6 + put TrimR = putWord8 7 get = getWord8 >>= \tag -> case tag of 0 -> Chunk <$> get @@ -83,8 +87,9 @@ instance Binary TemplateElement where 3 -> If <$> get <*> get <*> get 4 -> For <$> get <*> get <*> get 5 -> Partial <$> get - _ -> error $ - "Hakyll.Web.Template.Internal: Error reading cached template" + 6 -> pure TrimL + 7 -> pure TrimR + _ -> error "Hakyll.Web.Template.Internal: Error reading cached template" -------------------------------------------------------------------------------- @@ -114,8 +119,7 @@ instance Binary TemplateExpr where 0 -> Ident <$> get 1 -> Call <$> get <*> get 2 -> StringLiteral <$> get - _ -> error $ - "Hakyll.Web.Tamplte.Internal: Error reading cached template" + _ -> error "Hakyll.Web.Template.Internal: Error reading cached template" -------------------------------------------------------------------------------- |