Skip to content

Commit

Permalink
Use overText function from mustache
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-leapyear committed Feb 27, 2021
1 parent 32f0eeb commit b64b0f5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions scripts/generate/GeneratePersistentAPI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeApplications #-}

import Control.Monad (forM_)
import Data.Aeson (FromJSON(..), withObject, (.!=), (.:), (.:?))
Expand Down Expand Up @@ -98,14 +97,15 @@ instance ToMustache FunctionContext where
, "sqlQueryRepRecord" ~> sqlQueryRepRecord
, "recordTypeVars" ~> recordTypeVars
, "result" ~> if hasConduitFrom then result else "m " <> result
, "withCondition" ~> \stree -> pure @Mustache.SubM $
, "withCondition" ~> Mustache.overText (\t ->
case condition of
Nothing -> stree
Just cond -> concat
[ [Mustache.TextBlock $ "#if " <> cond <>"\n"]
, stree
, [Mustache.TextBlock "#endif\n"]
Nothing -> t
Just cond -> Text.concat
[ "#if " <> cond <> "\n"
, t
, "#endif\n"
]
)
, "conduitFrom?" ~> hasConduitFrom
, "conduitFrom" ~> conduitFrom

Expand Down

0 comments on commit b64b0f5

Please sign in to comment.