Safe Haskell | None |
---|
A Shakespearean module for Javascript templates, introducing type-safe,
compile-time variable and url interpolation.--
To use this module, coffee
must be installed on your system.
You might consider trying Coffee
, which compiles down to Javascript.
Further reading: http://www.yesodweb.com/book/templates
This module is currently in an identity crisis. Originally called Julius, now being changed to just Javascript (shakespeare-javascript)
- js, julius :: QuasiQuoter
- jsFile, juliusFile :: FilePath -> Q Exp
- jsFileDebug, juliusFileDebug :: FilePath -> Q Exp
- jsFileReload, juliusFileReload :: FilePath -> Q Exp
- type JavascriptUrl url = (url -> [(Text, Text)] -> Text) -> Javascript
- newtype Javascript = Javascript {}
- class ToJavascript a where
- toJavascript :: a -> Builder
- renderJavascript :: Javascript -> Text
- renderJavascriptUrl :: (url -> [(Text, Text)] -> Text) -> JavascriptUrl url -> Text
- javascriptSettings :: Q ShakespeareSettings
Functions
Template-Reading Functions
These QuasiQuoter and Template Haskell methods return values of
type
. See the Yesod book for details.
JavascriptUrl
url
jsFileDebug, juliusFileDebug :: FilePath -> Q ExpSource
Datatypes
type JavascriptUrl url = (url -> [(Text, Text)] -> Text) -> JavascriptSource
Return type of template-reading functions.
newtype Javascript Source
Newtype wrapper of Builder
.
Typeclass for interpolated variables
class ToJavascript a whereSource
A typeclass for types that can be interpolated in CoffeeScript templates.
toJavascript :: a -> BuilderSource
Rendering Functions
renderJavascriptUrl :: (url -> [(Text, Text)] -> Text) -> JavascriptUrl url -> TextSource
render with route interpolation. If using this module standalone, apart from type-safe routes, a dummy renderer can be used:
renderJavascriptUrl (\_ _ -> undefined) javascriptUrl
When using Yesod, a renderer is generated for you, which can be accessed
within the GHandler monad: getUrlRenderParams
.