xhtml-3000.2.0.0: An XHTML combinator library

Text.XHtml.Strict

Contents

Description

Produces XHTML 1.0 Strict.

Synopsis

Data types

data HtmlAttr Source

Attributes with name and value.

Instances

Classes

class HTML a whereSource

HTML is the class of things that can be validly put inside an HTML tag. So this can be one or more Html elements, or a String, for example.

Methods

toHtml :: a -> HtmlSource

toHtmlFromList :: [a] -> HtmlSource

Instances

class ADDATTRS a whereSource

Methods

(!) :: a -> [HtmlAttr] -> aSource

Instances

Primitives and basic combinators

(<<)Source

Arguments

:: HTML a 
=> (Html -> b)

Parent

-> a

Child

-> b 

Put something inside an HTML element.

concatHtml :: HTML a => [a] -> HtmlSource

(+++) :: (HTML a, HTML b) => a -> b -> HtmlSource

Create a piece of HTML which is the concatenation of two things which can be made into HTML.

noHtml :: HtmlSource

An empty piece of HTML.

isNoHtml :: Html -> BoolSource

Checks whether the given piece of HTML is empty.

tagSource

Arguments

:: String

Element name

-> Html

Element contents

-> Html 

Constructs an element with a custom name.

itag :: String -> HtmlSource

Constructs an element with a custom name, and without any children.

primHtml :: String -> HtmlSource

This is not processed for special chars. use stringToHtml or lineToHtml instead, for user strings, because they understand special chars, like <.

stringToHtmlString :: String -> StringSource

Processing Strings into Html friendly things.

Rendering

showHtml :: HTML html => html -> StringSource

The DOCTYPE for XHTML 1.0 Strict.

Output the HTML without adding newlines or spaces within the markup. This should be the most time and space efficient way to render HTML, though the ouput is quite unreadable.

renderHtml :: HTML html => html -> StringSource

Outputs indented HTML. Because space matters in HTML, the output is quite messy.

renderHtmlWithLanguageSource

Arguments

:: HTML html 
=> String

The code of the dominant language of the webpage.

-> html

All the Html, including a header.

-> String 

Outputs indented XHTML. Because space matters in HTML, the output is quite messy.

prettyHtml :: HTML html => html -> StringSource

Outputs indented HTML, with indentation inside elements. This can change the meaning of the HTML document, and is mostly useful for debugging the HTML output. The implementation is inefficient, and you are normally better off using showHtml or renderHtml.

showHtmlFragment :: HTML html => html -> StringSource

Render a piece of HTML without adding a DOCTYPE declaration or root element. Does not add any extra whitespace.

renderHtmlFragment :: HTML html => html -> StringSource

Render a piece of indented HTML without adding a DOCTYPE declaration or root element. Only adds whitespace where it does not change the meaning of the document.

prettyHtmlFragment :: HTML html => html -> StringSource

Render a piece of indented HTML without adding a DOCTYPE declaration or a root element. The indentation is done inside elements. This can change the meaning of the HTML document, and is mostly useful for debugging the HTML output. The implementation is inefficient, and you are normally better off using showHtmlFragment or renderHtmlFragment.

Elements in XHTML Strict

Attributes in XHTML Strict

Converting strings to HTML

stringToHtml :: String -> HtmlSource

Convert a String to Html, converting characters that need to be escaped to HTML entities.

lineToHtml :: String -> HtmlSource

This converts a string, but keeps spaces as non-line-breakable.

linesToHtml :: [String] -> HtmlSource

This converts a string, but keeps spaces as non-line-breakable, and adds line breaks between each of the strings in the input list.

Html abbreviations

copyright :: HtmlSource

Copyright sign.

spaceHtml :: HtmlSource

Non-breaking space.

p :: Html -> HtmlSource

Same as paragraph.

Hotlinks

Lists

ordList :: HTML a => [a] -> HtmlSource

unordList :: HTML a => [a] -> HtmlSource

defList :: (HTML a, HTML b) => [(a, b)] -> HtmlSource

Forms