Skip to content

Commit

Permalink
Cleanup following #1044
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentRDC committed Oct 29, 2024
1 parent 00d42d7 commit c1b814b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ title: Releases

# Releases

## Unreleased
## Hakyll 4.16.4.0 (unreleased)

- Fixed an issue where compressing CSS with `clamp` expressions would
result in invalid CSS (#1021) (contribution by Laurent P. René de Cotret)
- Added `boolFieldM` (#1044) (contribution by 0xd34df00d)

## Hakyll 4.16.3.0 (2024-10-24)

Expand Down
2 changes: 1 addition & 1 deletion hakyll.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: hakyll
Version: 4.16.3.0
Version: 4.16.4.0

Synopsis: A static website compiler library
Description:
Expand Down
18 changes: 12 additions & 6 deletions lib/Hakyll/Web/Template/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,22 @@ field key value = field' key (fmap StringField . value)
-- | Creates a 'field' to use with the @$if()$@ template macro.
-- Attempting to substitute the field into the template will cause an error.
boolField
:: String
-> (Item a -> Bool)
:: String -- ^ Key
-> (Item a -> Bool) -- ^ Extract value from an @'Item' a@
-> Context a
boolField name f = boolFieldM name (pure . f)

-- | Creates a 'field' to use with the @$if()$@ template macro, in the 'Compiler' monad.
-- Attempting to substitute the field into the template will cause an error.

--------------------------------------------------------------------------------
-- | Creates a 'field' to use with the @$if()$@ template macro, in the
-- 'Compiler' monad. Attempting to substitute the field into the template
-- will cause an error.
--
-- @since 4.16.4.0
boolFieldM
:: String
-> (Item a -> Compiler Bool)
:: String -- ^ Key
-> (Item a -> Compiler Bool) -- ^ Extract value from an @'Item' a@
-- from within the 'Compiler' monad
-> Context a
boolFieldM name f = field' name (\i -> do
b <- f i
Expand Down

0 comments on commit c1b814b

Please sign in to comment.