diff options
author | samgd <sam@samgd.com> | 2016-07-23 14:46:15 +0200 |
---|---|---|
committer | samgd <sam@samgd.com> | 2016-07-23 14:46:15 +0200 |
commit | 9867094bd27ed170315e7e02b788243d654c6bc1 (patch) | |
tree | 04911e756c9c5e8bfaeff241c091d63bb95c5f0b /src/Hakyll/Web/Template | |
parent | 430a0a8849191edfa7b53dcf76a0fb72f12ebde7 (diff) | |
download | hakyll-9867094bd27ed170315e7e02b788243d654c6bc1.tar.gz |
Expr trimming. '-' binds to '$'.
Diffstat (limited to 'src/Hakyll/Web/Template')
-rw-r--r-- | src/Hakyll/Web/Template/Internal.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Hakyll/Web/Template/Internal.hs b/src/Hakyll/Web/Template/Internal.hs index 6ccad74..fce163f 100644 --- a/src/Hakyll/Web/Template/Internal.hs +++ b/src/Hakyll/Web/Template/Internal.hs @@ -143,7 +143,7 @@ template = mconcat <$> P.many (P.choice [ lift chunk , conditional , for , partial - , lift expr + , expr ]) where lift = fmap (Template . (:[])) @@ -154,12 +154,15 @@ chunk = Chunk <$> P.many1 (P.noneOf "$") -------------------------------------------------------------------------------- -expr :: P.Parser TemplateElement +expr :: P.Parser Template expr = P.try $ do - void $ P.char '$' + trimLExpr <- trimOpen e <- expr' - void $ P.char '$' - return $ Expr e + trimRExpr <- trimClose + return $ Template $ mconcat [ [TrimL | trimLExpr] + , [Expr e] + , [TrimR | trimRExpr] + ] -------------------------------------------------------------------------------- |