mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-28 12:54:07 +03:00
web: define our own hamlet so it can be tweaked for debugging
This commit is contained in:
parent
cfa59cc4f8
commit
f6f615196f
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user