ginger-0.1.1.0: An implementation of the Jinja2 template language in Haskell

Safe HaskellNone
LanguageHaskell2010

Text.Ginger.Html

Description

A HTML type, useful for implementing type-safe conversion between plain text and HTML. The HTML representation used here assumed Unicode throughout, and UTF-8 should be used as the encoding when sending Html objects as responses to a HTTP client.

Synopsis

Documentation

data Html Source

A chunk of HTML source.

Instances

unsafeRawHtml :: Text -> Html Source

Convert a chunk of HTML source code into an Html value as-is. Note that this bypasses any and all HTML encoding; the caller is responsible for taking appropriate measures against XSS and other potential vulnerabilities. In other words, the input to this function is considered pre-sanitized.

html :: Text -> Html Source

Safely convert plain text to HTML.

htmlSource :: Html -> Text Source

Extract HTML source code from an Html value.

class ToHtml s where Source

Types that support conversion to HTML.

Methods

toHtml :: s -> Html Source

Instances

ToHtml Text Source

Text is automatically HTML-encoded

ToHtml Html Source

Html itself is a trivial instance

ToHtml [Char] Source

String is automatically HTML-encoded and converted to Text

ToHtml (GVal m) Source

Converting to HTML hooks into the ToHtml instance for Text for most tags. Tags that have no obvious textual representation render as empty HTML.