xhtml-3000.2.1: An XHTML combinator library

Safe HaskellSafe

Text.XHtml.Strict

Contents

Description

Produces XHTML 1.0 Strict.

Synopsis

Data types

data HtmlAttr Source

Attributes with name and value.

Instances

Show HtmlAttr 

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

HTML Char 
HTML Html 
HTML HotLink 
HTML HtmlTable 
HTML HtmlTree 
HTML a => HTML [a] 
HTML a => HTML (Maybe a) 

class ADDATTRS a whereSource

Methods

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

Instances

class CHANGEATTRS a whereSource

CHANGEATTRS is a more expressive alternative to ADDATTRS

Methods

changeAttrs :: a -> ([HtmlAttr] -> [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.

htmlAttrPair :: HtmlAttr -> (String, String)Source

intAttr :: String -> Int -> HtmlAttrSource

strAttr :: String -> String -> HtmlAttrSource

htmlAttr :: String -> Html -> HtmlAttrSource

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.

docType :: StringSource

The DOCTYPE for XHTML 1.0 Strict.

Rendering

showHtml :: HTML html => html -> StringSource

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

action :: String -> HtmlAttrSource

align :: String -> HtmlAttrSource

alt :: String -> HtmlAttrSource

altcode :: String -> HtmlAttrSource

archive :: String -> HtmlAttrSource

base :: String -> HtmlAttrSource

cols :: String -> HtmlAttrSource

content :: String -> HtmlAttrSource

coords :: String -> HtmlAttrSource

enctype :: String -> HtmlAttrSource

height :: String -> HtmlAttrSource

href :: String -> HtmlAttrSource

lang :: String -> HtmlAttrSource

method :: String -> HtmlAttrSource

name :: String -> HtmlAttrSource

rel :: String -> HtmlAttrSource

rev :: String -> HtmlAttrSource

rows :: String -> HtmlAttrSource

rules :: String -> HtmlAttrSource

shape :: String -> HtmlAttrSource

size :: String -> HtmlAttrSource

src :: String -> HtmlAttrSource

thefor :: String -> HtmlAttrSource

thetype :: String -> HtmlAttrSource

title :: String -> HtmlAttrSource

usemap :: String -> HtmlAttrSource

valign :: String -> HtmlAttrSource

value :: String -> HtmlAttrSource

width :: String -> HtmlAttrSource

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

type URL = StringSource

Lists

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

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

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

Forms

widget :: String -> String -> [HtmlAttr] -> HtmlSource

checkbox :: String -> String -> HtmlSource

hidden :: String -> String -> HtmlSource

radio :: String -> String -> HtmlSource

reset :: String -> String -> HtmlSource

submit :: String -> String -> HtmlSource

password :: String -> HtmlSource

textfield :: String -> HtmlSource

afile :: String -> HtmlSource

clickmap :: String -> HtmlSource

menu :: String -> [Html] -> HtmlSource

Deprecated: menu generates strange XHTML, and is not flexible enough. Roll your own that suits your needs.

gui :: String -> Html -> HtmlSource