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




Basic quasiquoters

xhamlet :: QuasiQuoterSource

Calls hamletWithSettings using XHTML 1.0 Strict settings.

hamlet' :: QuasiQuoterSource

Calls hamletWithSettings' with defaultHamletSettings.

xhamlet' :: QuasiQuoterSource

Calls hamletWithSettings' using XHTML 1.0 Strict settings.

hamletDebug :: QuasiQuoterSource

Calls hamletWithSettings with debugHamletSettings.

Load from external file

xhamletFile :: FilePath -> Q ExpSource

Calls hamletFileWithSettings using XHTML 1.0 Strict settings.

Customized settings

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.




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.

hamletCloseNewline :: Bool

Should we put a newline after closing a tag?

defaultHamletSettings :: HamletSettingsSource

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


data Html a

The core HTML datatype.


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

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

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


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

Converts a Hamlet to lazy bytestring.



:: 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

String to insert.

-> Html a

Resulting HTML fragment.

Create an HTML snippet from a String.



:: 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.

Runtime Hamlet