From 430a0a8849191edfa7b53dcf76a0fb72f12ebde7 Mon Sep 17 00:00:00 2001 From: samgd Date: Sat, 23 Jul 2016 12:52:55 +0200 Subject: Partial trimming --- src/Hakyll/Web/Template/Internal.hs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/Hakyll/Web/Template') diff --git a/src/Hakyll/Web/Template/Internal.hs b/src/Hakyll/Web/Template/Internal.hs index 983bd16..6ccad74 100644 --- a/src/Hakyll/Web/Template/Internal.hs +++ b/src/Hakyll/Web/Template/Internal.hs @@ -142,7 +142,7 @@ template = mconcat <$> P.many (P.choice [ lift chunk , lift escaped , conditional , for - , lift partial + , partial , lift expr ]) where lift = fmap (Template . (:[])) @@ -246,12 +246,18 @@ for = P.try $ do -------------------------------------------------------------------------------- -partial :: P.Parser TemplateElement +partial :: P.Parser Template partial = P.try $ do - void $ P.string "$partial(" + trimLPartial <- trimOpen + void $ P.string "partial(" e <- expr' - void $ P.string ")$" - return $ Partial e + void $ P.char ')' + trimRPartial <- trimClose + + pure $ Template $ mconcat [ [TrimL | trimLPartial] + , [Partial e] + , [TrimR | trimRPartial] + ] -------------------------------------------------------------------------------- -- cgit v1.2.3