hamlet-1.1.7.1: Haml-like template files that are compile-time checked

Safe HaskellNone

Text.Hamlet

Contents

Synopsis

Plain HTML

type Html = Markup

Hamlet

type HtmlUrl url = Render url -> HtmlSource

A function generating an Html given a URL-rendering function.

I18N Hamlet

type HtmlUrlI18n msg url = Translate msg -> Render url -> HtmlSource

A function generating an Html given a message translator and a URL rendering function.

Type classes

class ToAttributes a whereSource

Convert some value to a list of attribute pairs.

Methods

toAttributes :: a -> [(Text, Text)]Source

Internal, for making more

data HamletSettings Source

Settings for parsing of a hamlet document.

Constructors

HamletSettings 

Fields

hamletDoctype :: String

The value to replace a "!!!" with. Do not include the trailing newline.

hamletNewlines :: NewlineStyle

Should we add newlines to the output, making it more human-readable? Useful for client-side debugging but may alter browser page layout.

hamletCloseStyle :: String -> CloseStyle

How a tag should be closed. Use this to switch between HTML, XHTML or even XML output.

hamletDoctypeNames :: [(String, String)]

Mapping from short names in "$doctype" statements to full doctype.

data NewlineStyle Source

Constructors

NoNewlines

never add newlines

NewlinesText

add newlines between consecutive text lines

AlwaysNewlines

add newlines everywhere

DefaultNewlineStyle 

Instances

defaultHamletSettings :: HamletSettingsSource

Defaults settings: HTML5 doctype and HTML-style empty tags.

data Env Source

Constructors

Env 

Fields

urlRender :: Maybe ((Exp -> Q Exp) -> Q Exp)
 
msgRender :: Maybe ((Exp -> Q Exp) -> Q Exp)
 

data HamletRules Source

Constructors

HamletRules 

Fields

hrFromHtml :: Exp
 
hrWithEnv :: (Env -> Q Exp) -> Q Exp
 
hrEmbed :: Env -> Exp -> Q Exp