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

Text.Hamlet

Contents

Synopsis

Basic quasiquoters

xhamlet :: QuasiQuoterSource

Calls hamletWithSettings using XHTML 1.0 Strict settings.

Build customized quasiquoters

hamletWithSettings :: HamletSettings -> QuasiQuoterSource

A quasi-quoter that converts Hamlet syntax into a function of form:

 (url -> String) -> Html

Please see accompanying documentation for a description of Hamlet syntax.

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.

hamletCloseEmpties :: Bool

True means to close empty tags (eg, img) with a trailing slash, ie XML-style empty tags. False uses HTML-style.

defaultHamletSettings :: HamletSettingsSource

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

Datatypes

data Html a

The core HTML datatype.

Instances

Monad Html 
IsString (Html a) 
Monoid (Html a) 
Attributable (Html a) 
Attributable (Html a -> Html b) 

type Hamlet url = (url -> String) -> Html ()Source

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

Construction/rendering

renderHamlet :: (url -> String) -> Hamlet url -> ByteStringSource

Converts a Hamlet to lazy bytestring.

renderHtml

Arguments

:: Html a

Document to render.

-> ByteString

Resulting output.

O(n). Render the HTML fragment to lazy ByteString.

preEscapedString :: String -> Html a

Create an HTML snippet from a String without escaping

string

Arguments

:: String

String to insert.

-> Html a

Resulting HTML fragment.

Create an HTML snippet from a String.

unsafeByteString

Arguments

:: ByteString

Value to insert.

-> Html a

Resulting HTML fragment.

Insert a ByteString. This is an unsafe operation:

  • The ByteString could have the wrong encoding.
  • The ByteString might contain illegal HTML characters (no escaping is done).

cdata :: Html () -> Html ()Source

Wrap an Html for embedding in an XML file.