xml-html-qq-0.1.0.1: Quasi-quoters for XML and HTML Documents

Copyright | Dennis Gosnell 2017
License | BSD3
Maintainer | Dennis Gosnell (cdep.illabout@gmail.com)
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Text.HTML.QQ

Contents

- Types

Description

This module provides a quasi-quoter for HTML `Document`s. See the `html` function for some examples.

See Text.XML.QQ for an explanation of the difference between Text.HTML.QQ and Text.XML.QQ.

Synopsis

- html :: QuasiQuoter
- htmlRaw :: QuasiQuoter
- data Document

# Documentation

html :: QuasiQuoter Source #

This `QuasiQuoter` produces HTML `Document`s.

This `QuasiQuoter` produces expressions of type `Document`.

Here's a simple example of using it:

    >>> [html|<html></html>|] :: Document
    Document {documentPrologue = Prologue {prologueBefore = [], prologueDoctype = Nothing, prologueAfter = []}, documentRoot = Element {elementName = Name {nameLocalName = "html", nameNamespace = Nothing, namePrefix = Nothing}, elementAttributes = fromList [], elementNodes = []}, documentEpilogue = []}

Internally, this function is using the heterocephalus package. This means you can use variable interpolation, as well as `forall`, `if`, and `case` control statements. Checkout the heterocephalus README for more info.

    >>> let a = "hello world"
    >>> [html|<html>#{a}</html>|]
    Document ...

Even invalid HTML will still parse.

    >>> [html|<html </html>|]
    Document ...

Here's an example of a template that can be parsed as an HTML `Document`, but not as an XML `Document`:

    >>> [html|<html><br></html>|]
    Document ...

htmlRaw :: QuasiQuoter Source #

This function is the same as `html`, but doesn't allow variable interpolation or control statements. It also produces expressions of type `Document`.

Here's a simple example of using it:

    >>> [htmlRaw|<html></html>|] :: Document
    Document ...

# Types

data Document Source #

#### Instances

Instances details

ToMarkup Document |
Instance details Defined in Text.XML Methods toMarkup :: Document -> Markup Source # preEscapedToMarkup :: Document -> Markup Source #
NFData Document |
Instance details Defined in Text.XML Methods rnf :: Document -> () Source #
Data Document |

Instance details

Defined in Text.XML

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Document -> c Document Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Document Source #

toConstr :: Document -> Constr Source #

dataTypeOf :: Document -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Document) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Document) Source #

gmapT :: (forall b. Data b => b -> b) -> Document -> Document Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Document -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Document -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Document -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Document -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Document -> m Document Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Document -> m Document Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Document -> m Document Source #

Show Document |
Instance details Defined in Text.XML Methods showsPrec :: Int -> Document -> ShowS Source # show :: Document -> String Source # showList :: [Document] -> ShowS Source #
Eq Document |
Instance details Defined in Text.XML Methods (==) :: Document -> Document -> Bool Source # (/=) :: Document -> Document -> Bool Source #
Lift Document Source # |
Instance details Defined in Text.XMLHTML.Internal Methods lift :: Quote m => Document -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => Document -> Code m Document Source #