@@ -64,6 +64,8 @@ data TemplateElement
64 | If TemplateExpr Template (Maybe Template) -- expr, then, else
64 | If TemplateExpr Template (Maybe Template) -- expr, then, else
65 | For TemplateExpr Template (Maybe Template) -- expr, body, separator
65 | For TemplateExpr Template (Maybe Template) -- expr, body, separator
66 | Partial TemplateExpr -- filename
66 | Partial TemplateExpr -- filename
67 deriving (Show, Eq, Typeable)
69 deriving (Show, Eq, Typeable)
@@ -71,10 +73,12 @@ data TemplateElement
71instance Binary TemplateElement where
73instance Binary TemplateElement where
72 put (Chunk string) = putWord8 0 >> put string
74 put (Chunk string) = putWord8 0 >> put string
73 put (Expr e) = putWord8 1 >> put e
75 put (Expr e) = putWord8 1 >> put e
74− put (Escaped) = putWord8 2
76+ put Escaped = putWord8 2
75− put (If e t f ) = putWord8 3 >> put e >> put t >> put f
77+ put (If e t f) = putWord8 3 >> put e >> put t >> put f
76 put (For e b s) = putWord8 4 >> put e >> put b >> put s
78 put (For e b s) = putWord8 4 >> put e >> put b >> put s
77 put (Partial e) = putWord8 5 >> put e
79 put (Partial e) = putWord8 5 >> put e
80+ put TrimL = putWord8 6
81+ put TrimR = putWord8 7
79 get = getWord8 >>= \tag -> case tag of
83 get = getWord8 >>= \tag -> case tag of
80 0 -> Chunk <$> get
84 0 -> Chunk <$> get
@@ -83,8 +87,9 @@ instance Binary TemplateElement where
83 3 -> If <$> get <*> get <*> get
87 3 -> If <$> get <*> get <*> get
84 4 -> For <$> get <*> get <*> get
88 4 -> For <$> get <*> get <*> get
85 5 -> Partial <$> get
89 5 -> Partial <$> get
86− _ -> error $
90+ 6 -> pure TrimL
87− "Hakyll.Web.Template.Internal: Error reading cached template"
92+ _ -> error "Hakyll.Web.Template.Internal: Error reading cached template"
90--------------------------------------------------------------------------------
95--------------------------------------------------------------------------------
@@ -114,8 +119,7 @@ instance Binary TemplateExpr where
114 0 -> Ident <$> get
119 0 -> Ident <$> get
115 1 -> Call <$> get <*> get
120 1 -> Call <$> get <*> get
116 2 -> StringLiteral <$> get
121 2 -> StringLiteral <$> get
118− "Hakyll.Web.Tamplte.Internal: Error reading cached template"
122+ _ -> error "Hakyll.Web.Template.Internal: Error reading cached template"
121--------------------------------------------------------------------------------
125--------------------------------------------------------------------------------