| 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
Description
This module provides a quasi-quoter for HTML Documents. 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.
- html :: QuasiQuoter
- htmlRaw :: QuasiQuoter
- data Document :: *
Documentation
html :: QuasiQuoter Source #
This QuasiQuoter produces HTML Documents.
This QuasiQuoter produces expressions of type Document.
Here's a simple example of using it:
>>>[html|<html></html>|] :: DocumentDocument {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 ...