diff options
| author | Chris Wells <chris@mathematicaster.org> | 2025-02-11 14:47:40 -0600 |
|---|---|---|
| committer | Chris Wells <chris@mathematicaster.org> | 2025-02-11 14:47:40 -0600 |
| commit | e914e77f87a51c25141ab297d11344118a6f6e20 (patch) | |
| tree | 0aef8b8da0a6ad630834d77a838657b839d791f0 /src/Hakyll/Web/Template | |
| parent | 0c677070edf9978cb85a0b521f7e6e0ef6d6b491 (diff) | |
| download | main-e914e77f87a51c25141ab297d11344118a6f6e20.tar main-e914e77f87a51c25141ab297d11344118a6f6e20.tar.gz main-e914e77f87a51c25141ab297d11344118a6f6e20.tar.bz2 main-e914e77f87a51c25141ab297d11344118a6f6e20.tar.lz main-e914e77f87a51c25141ab297d11344118a6f6e20.tar.xz main-e914e77f87a51c25141ab297d11344118a6f6e20.tar.zst main-e914e77f87a51c25141ab297d11344118a6f6e20.zip | |
Working on aliases
Diffstat (limited to 'src/Hakyll/Web/Template')
| -rw-r--r-- | src/Hakyll/Web/Template/Util.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Hakyll/Web/Template/Util.hs b/src/Hakyll/Web/Template/Util.hs index cfd8573..f08c041 100644 --- a/src/Hakyll/Web/Template/Util.hs +++ b/src/Hakyll/Web/Template/Util.hs @@ -1,11 +1,18 @@ module Hakyll.Web.Template.Util - ( slug + ( functionField1 + , slug ) where import Prolog +import Hakyll import Hakyll.Web.Template.Context import Data.String.Slugger +import System.FilePath +functionField1 :: String -> (String -> Compiler String) -> Context a +functionField1 n f = functionField n $ \case + [x] -> \_ -> f x + xs -> \_ -> fail $ "Expecting exactly one argument to " <> n <> ". Instead got " <> show (length xs) slug :: Context a slug = functionField "slug" $ \strs _ -> pure $ toSlug $ unwords strs |
