shakespeare-2.0.22: A toolkit for making compile-time interpolated templates

Safe HaskellNone
LanguageHaskell98

Text.Julius

Contents

Description

A Shakespearean module for Javascript templates, introducing type-safe, compile-time variable and url interpolation.--

You might consider trying Typescript or Coffee which compile down to Javascript.

Further reading: http://www.yesodweb.com/book/shakespearean-templates

Synopsis

Functions

Template-Reading Functions

These QuasiQuoter and Template Haskell methods return values of type JavascriptUrl url. See the Yesod book for details.

juliusFileDebug :: FilePath -> Q Exp Source #

Deprecated: Please use juliusFileReload instead.

jsFileDebug :: FilePath -> Q Exp Source #

Deprecated: Please use jsFileReload instead.

Datatypes

type JavascriptUrl url = (url -> [(Text, Text)] -> Text) -> Javascript Source #

Return type of template-reading functions.

newtype Javascript Source #

Newtype wrapper of Builder.

Constructors

Javascript 

newtype RawJavascript Source #

Constructors

RawJavascript Builder 
Instances
ToJavascript RawJavascript Source # 
Instance details

Defined in Text.Julius

Typeclass for interpolated variables

class ToJavascript a where Source #

A typeclass for types that can be interpolated in CoffeeScript templates.

Instances
ToJavascript Bool Source # 
Instance details

Defined in Text.Julius

ToJavascript Text Source # 
Instance details

Defined in Text.Julius

ToJavascript Value Source # 
Instance details

Defined in Text.Julius

ToJavascript Text Source # 
Instance details

Defined in Text.Julius

ToJavascript String Source # 
Instance details

Defined in Text.Julius

ToJavascript RawJavascript Source # 
Instance details

Defined in Text.Julius

class RawJS a where Source #

Methods

rawJS :: a -> RawJavascript Source #

Instances
RawJS Bool Source # 
Instance details

Defined in Text.Julius

RawJS Builder Source # 
Instance details

Defined in Text.Julius

RawJS Text Source # 
Instance details

Defined in Text.Julius

RawJS Text Source # 
Instance details

Defined in Text.Julius

RawJS [Char] Source # 
Instance details

Defined in Text.Julius

Rendering Functions

renderJavascriptUrl :: (url -> [(Text, Text)] -> Text) -> JavascriptUrl url -> Text Source #

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.

internal, used by Coffee

internal

juliusUsedIdentifiers :: String -> [(Deref, VarType)] Source #

Determine which identifiers are used by the given template, useful for creating systems like yesod devel.