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

Safe Haskell | None

Text.Hamlet

Contents

- Plain HTML
- Hamlet
- I18N Hamlet
- Type classes
- Internal, for making more

Synopsis

- type Html = Markup
- shamlet :: QuasiQuoter
- shamletFile :: FilePath -> Q Exp
- xshamlet :: QuasiQuoter
- xshamletFile :: FilePath -> Q Exp
- type HtmlUrl url = Render url -> Html
- hamlet :: QuasiQuoter
- hamletFile :: FilePath -> Q Exp
- xhamlet :: QuasiQuoter
- xhamletFile :: FilePath -> Q Exp
- type HtmlUrlI18n msg url = Translate msg -> Render url -> Html
- ihamlet :: QuasiQuoter
- ihamletFile :: FilePath -> Q Exp
- class ToAttributes a where
  - toAttributes :: a -> [(Text, Text)]
- data HamletSettings = HamletSettings {
  - hamletDoctype :: String
  - hamletNewlines :: NewlineStyle
  - hamletCloseStyle :: String -> CloseStyle
  - hamletDoctypeNames :: [(String, String)]
  }
- data NewlineStyle
  - = NoNewlines
  - | NewlinesText
  - | AlwaysNewlines
  - | DefaultNewlineStyle
- hamletWithSettings :: Q HamletRules -> HamletSettings -> QuasiQuoter
- hamletFileWithSettings :: Q HamletRules -> HamletSettings -> FilePath -> Q Exp
- defaultHamletSettings :: HamletSettings
- xhtmlHamletSettings :: HamletSettings
- data Env = Env {
  - urlRender :: Maybe ((Exp -> Q Exp) -> Q Exp)
  - msgRender :: Maybe ((Exp -> Q Exp) -> Q Exp)
  }
- data HamletRules = HamletRules {
  - hrFromHtml :: Exp
  - hrWithEnv :: (Env -> Q Exp) -> Q Exp
  - hrEmbed :: Env -> Exp -> Q Exp
  }
- hamletRules :: Q HamletRules
- ihamletRules :: Q HamletRules
- htmlRules :: Q HamletRules
- data CloseStyle
  - = NoClose
  - | CloseInside
  - | CloseSeparate

# Plain HTML

type Html = Markup

shamlet :: QuasiQuoter Source

shamletFile :: FilePath -> Q Exp Source

xshamlet :: QuasiQuoter Source

xshamletFile :: FilePath -> Q Exp Source

# Hamlet

type HtmlUrl url = Render url -> Html Source

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

hamlet :: QuasiQuoter Source

hamletFile :: FilePath -> Q Exp Source

xhamlet :: QuasiQuoter Source

xhamletFile :: FilePath -> Q Exp Source

# I18N Hamlet

type HtmlUrlI18n msg url = Translate msg -> Render url -> Html Source

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

ihamlet :: QuasiQuoter Source

ihamletFile :: FilePath -> Q Exp Source

# Type classes

class ToAttributes a where Source

Convert some value to a list of attribute pairs.

Methods

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

Instances

ToAttributes [(String, String)] |
ToAttributes [(Text, Text)] |
ToAttributes (String, String) |
ToAttributes (Text, Text) |

# 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

Show NewlineStyle |

hamletWithSettings :: Q HamletRules -> HamletSettings -> QuasiQuoter Source

hamletFileWithSettings :: Q HamletRules -> HamletSettings -> FilePath -> Q Exp Source

defaultHamletSettings :: HamletSettings Source

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

xhtmlHamletSettings :: HamletSettings Source

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

hamletRules :: Q HamletRules Source

ihamletRules :: Q HamletRules Source

htmlRules :: Q HamletRules Source

data CloseStyle Source

Constructors

NoClose |
CloseInside |
CloseSeparate |