web: define our own hamlet so it can be tweaked for debugging

This commit is contained in:
Simon Michael 2012-04-01 20:49:36 +00:00
parent cfa59cc4f8
commit f6f615196f
3 changed files with 13 additions and 4 deletions

View File

@ -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.

View File

@ -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

View File

@ -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