diff --git a/hledger-web/Hledger/Web/Foundation.hs b/hledger-web/Hledger/Web/Foundation.hs index 20534f536..62de493e5 100644 --- a/hledger-web/Hledger/Web/Foundation.hs +++ b/hledger-web/Hledger/Web/Foundation.hs @@ -26,11 +26,10 @@ import Yesod.Static import Yesod.Logger (Logger, logMsg, formatLogText) import Control.Monad.IO.Class (liftIO) import Web.ClientSession (getKey) -import Text.Hamlet import Hledger.Web.Options -import qualified Hledger.Web.Settings -import Hledger.Web.Settings (Extra (..)) +import qualified Hledger.Web.Settings (staticDir) +import Hledger.Web.Settings (Extra (..), hamlet) import Hledger.Web.Settings.StaticFiles -- | The web application's configuration and data, available to all request handlers. diff --git a/hledger-web/Hledger/Web/Handlers.hs b/hledger-web/Hledger/Web/Handlers.hs index ad9807074..3ea90768e 100644 --- a/hledger-web/Hledger/Web/Handlers.hs +++ b/hledger-web/Hledger/Web/Handlers.hs @@ -53,7 +53,7 @@ import System.FilePath (takeFileName) import System.IO.Storage (putValue, getValue) import System.Locale (defaultTimeLocale) import Text.Blaze (preEscapedString, toHtml) -import Text.Hamlet hiding (hamletFile) +import Text.Hamlet hiding (hamlet) import Text.Printf import Yesod.Core -- import Yesod.Json diff --git a/hledger-web/Hledger/Web/Settings.hs b/hledger-web/Hledger/Web/Settings.hs index 4311f88aa..54ed79e2c 100644 --- a/hledger-web/Hledger/Web/Settings.hs +++ b/hledger-web/Hledger/Web/Settings.hs @@ -10,6 +10,7 @@ module Hledger.Web.Settings , staticDir , Extra (..) , parseExtra + , hamlet , defport , defbaseurl , hledgerorgurl @@ -20,11 +21,13 @@ import Control.Applicative import Data.Text (Text) import Data.Yaml import Language.Haskell.TH.Syntax +import Language.Haskell.TH.Quote import Prelude import Text.Printf import Text.Shakespeare.Text (st) import Yesod.Default.Config import qualified Yesod.Default.Util +import qualified Text.Hamlet (hamlet) hledgerorgurl, manualurl :: String @@ -78,3 +81,10 @@ parseExtra :: DefaultEnv -> Object -> Parser Extra parseExtra _ o = Extra <$> o .: "copyright" <*> o .:? "analytics" + +hamlet :: QuasiQuoter +#if DEVELOPMENT +hamlet = Text.Hamlet.hamlet -- Text.Hamlet.hamlet' when available +#else +hamlet = Text.Hamlet.hamlet +#endif