CHXHtml-0.1.0: A W3C compliant (X)HTML generating library

Portabilityportable
Stabilityexperimental
Maintainerpaul@fuzzpault.com

Text.CHXHtml.XHtml1_strict

Contents

Description

Description : CHXHtml (Compliant Haskell XHtml) produces W3C valid XHTML1 strict content in most cases* by building a datastructure based on the DTD. Nesting and allowed tags are controlled by recursive types. To simplify usage, type classes are used to substitute the corret constructor for the given context, or throw a type error if the tag is not allowed in that context. As a result, a single function exists per tag as well as attribute names.

Each tag has two variants, one with and one without parameters, specified as _{tag} [{children tags}] or {tag}_ [{attributes}] [{children tags}]. Underscores prevents namespace conflicts with Prelude as well as cleaning up the syntax otherwise present using imported qualified.

Textual data is entered with the function pcdata String wherever pcdata is allowed. pcdata is HTML excaped for safety. For speed the variant pcdata_bs Data.ByteString can be used which bypasses excaping.

Attributes are specified by the functions {attribute name}_att, followed by its value of the correct type. See below for specifics. For W3C compliance only the last attribute will be used if duplicate names exist.

Rendering to a String is done with the render function, or to a Data.ByteString via the render_bs function. Note that Data.ByteString is significatly faster than Strings.

Under the hood we use a myriad of datatypes for tags and attributes whos details have been omitted below for brevity. To assist in selecting allowed tags and attributes htmlHelp is provided which produces allowed children and attributes given a tag's nesting position. See htmlHelp below for usage.

*Note we do not enforce tag ordering as described in the DTD.

Synopsis

Tag & Attribute Help

htmlHelp :: [String] -> [[String]]Source

htmlHelp provides a way of finding allowed children tags and attributes. For example a h1 inside a body tag inside an html tag is queried with

 htmlHelp ["html","body","h1"]
 = [["a","abbr",..,"tt","var"],["alt_att","class_att","dir_att",..,"usemap_att","width_att"]]

which returns a list of 2 elements, each their own list. The first is the allowed children tags, in this case 34. The second is a list of allowed attributes for the h1 tag. Remember to add a _ as a prefix or suffix of all tags, as well as _bs if providing a Data.ByteString to an attribute.

Rendering

render :: Render a => a -> StringSource

render_bs :: Render a => a -> ByteStringSource

Tags

pcdata :: C_PCDATA a => String -> aSource

_html :: [Ent0] -> EntSource

html_ :: [Att0] -> [Ent0] -> EntSource

_a :: C_A a b => [b] -> aSource

a_ :: C_A a b => [Att16] -> [b] -> aSource

_abbr :: C_Abbr a b => [b] -> aSource

abbr_ :: C_Abbr a b => [Att11] -> [b] -> aSource

_acronym :: C_Acronym a b => [b] -> aSource

acronym_ :: C_Acronym a b => [Att11] -> [b] -> aSource

_address :: C_Address a b => [b] -> aSource

address_ :: C_Address a b => [Att11] -> [b] -> aSource

_area :: C_Area a => aSource

area_ :: C_Area a => [Att27] -> aSource

_b :: C_B a b => [b] -> aSource

b_ :: C_B a b => [Att11] -> [b] -> aSource

_base :: C_Base a => aSource

base_ :: C_Base a => [Att3] -> aSource

_bdo :: C_Bdo a b => [b] -> aSource

bdo_ :: C_Bdo a b => [Att11] -> [b] -> aSource

_big :: C_Big a b => [b] -> aSource

big_ :: C_Big a b => [Att11] -> [b] -> aSource

_blockquote :: C_Blockquote a b => [b] -> aSource

blockquote_ :: C_Blockquote a b => [Att14] -> [b] -> aSource

_body :: C_Body a b => [b] -> aSource

body_ :: C_Body a b => [Att12] -> [b] -> aSource

_br :: C_Br a => aSource

br_ :: C_Br a => [Att19] -> aSource

_button :: C_Button a b => [b] -> aSource

button_ :: C_Button a b => [Att40] -> [b] -> aSource

_caption :: C_Caption a b => [b] -> aSource

caption_ :: C_Caption a b => [Att11] -> [b] -> aSource

_cite :: C_Cite a b => [b] -> aSource

cite_ :: C_Cite a b => [Att11] -> [b] -> aSource

_code :: C_Code a b => [b] -> aSource

code_ :: C_Code a b => [Att11] -> [b] -> aSource

_col :: C_Col a => aSource

col_ :: C_Col a => [Att43] -> aSource

_colgroup :: C_Colgroup a b => [b] -> aSource

colgroup_ :: C_Colgroup a b => [Att43] -> [b] -> aSource

_dd :: C_Dd a b => [b] -> aSource

dd_ :: C_Dd a b => [Att11] -> [b] -> aSource

_del :: C_Del a b => [b] -> aSource

del_ :: C_Del a b => [Att15] -> [b] -> aSource

_dfn :: C_Dfn a b => [b] -> aSource

dfn_ :: C_Dfn a b => [Att11] -> [b] -> aSource

_div :: C_Div a b => [b] -> aSource

div_ :: C_Div a b => [Att11] -> [b] -> aSource

_dl :: C_Dl a b => [b] -> aSource

dl_ :: C_Dl a b => [Att11] -> [b] -> aSource

_dt :: C_Dt a b => [b] -> aSource

dt_ :: C_Dt a b => [Att11] -> [b] -> aSource

_em :: C_Em a b => [b] -> aSource

em_ :: C_Em a b => [Att11] -> [b] -> aSource

_fieldset :: C_Fieldset a b => [b] -> aSource

fieldset_ :: C_Fieldset a b => [Att11] -> [b] -> aSource

_form :: C_Form a b => [b] -> aSource

form_ :: C_Form a b => [Att28] -> [b] -> aSource

_h1 :: C_H1 a b => [b] -> aSource

h1_ :: C_H1 a b => [Att11] -> [b] -> aSource

_h2 :: C_H2 a b => [b] -> aSource

h2_ :: C_H2 a b => [Att11] -> [b] -> aSource

_h3 :: C_H3 a b => [b] -> aSource

h3_ :: C_H3 a b => [Att11] -> [b] -> aSource

_h4 :: C_H4 a b => [b] -> aSource

h4_ :: C_H4 a b => [Att11] -> [b] -> aSource

_h5 :: C_H5 a b => [b] -> aSource

h5_ :: C_H5 a b => [Att11] -> [b] -> aSource

_h6 :: C_H6 a b => [b] -> aSource

h6_ :: C_H6 a b => [Att11] -> [b] -> aSource

_head :: C_Head a b => [b] -> aSource

head_ :: C_Head a b => [Att1] -> [b] -> aSource

_hr :: C_Hr a => aSource

hr_ :: C_Hr a => [Att11] -> aSource

_i :: C_I a b => [b] -> aSource

i_ :: C_I a b => [Att11] -> [b] -> aSource

_img :: C_Img a => aSource

img_ :: C_Img a => [Att22] -> aSource

_input :: C_Input a => aSource

input_ :: C_Input a => [Att31] -> aSource

_ins :: C_Ins a b => [b] -> aSource

ins_ :: C_Ins a b => [Att15] -> [b] -> aSource

_kbd :: C_Kbd a b => [b] -> aSource

kbd_ :: C_Kbd a b => [Att11] -> [b] -> aSource

_label :: C_Label a b => [b] -> aSource

label_ :: C_Label a b => [Att30] -> [b] -> aSource

_legend :: C_Legend a b => [b] -> aSource

legend_ :: C_Legend a b => [Att39] -> [b] -> aSource

_li :: C_Li a b => [b] -> aSource

li_ :: C_Li a b => [Att11] -> [b] -> aSource

_link :: C_Link a => aSource

link_ :: C_Link a => [Att7] -> aSource

_map :: C_Map a b => [b] -> aSource

map_ :: C_Map a b => [Att25] -> [b] -> aSource

_meta :: C_Meta a => aSource

meta_ :: C_Meta a => [Att5] -> aSource

_noscript :: C_Noscript a b => [b] -> aSource

noscript_ :: C_Noscript a b => [Att11] -> [b] -> aSource

_object :: C_Object a b => [b] -> aSource

object_ :: C_Object a b => [Att20] -> [b] -> aSource

_ol :: C_Ol a b => [b] -> aSource

ol_ :: C_Ol a b => [Att11] -> [b] -> aSource

_optgroup :: C_Optgroup a b => [b] -> aSource

optgroup_ :: C_Optgroup a b => [Att33] -> [b] -> aSource

_option :: C_Option a b => [b] -> aSource

option_ :: C_Option a b => [Att35] -> [b] -> aSource

_p :: C_P a b => [b] -> aSource

p_ :: C_P a b => [Att11] -> [b] -> aSource

_param :: C_Param a => aSource

param_ :: C_Param a => [Att21] -> aSource

_pre :: C_Pre a b => [b] -> aSource

pre_ :: C_Pre a b => [Att13] -> [b] -> aSource

_q :: C_Q a b => [b] -> aSource

q_ :: C_Q a b => [Att14] -> [b] -> aSource

_samp :: C_Samp a b => [b] -> aSource

samp_ :: C_Samp a b => [Att11] -> [b] -> aSource

_script :: C_Script a b => [b] -> aSource

script_ :: C_Script a b => [Att10] -> [b] -> aSource

_select :: C_Select a b => [b] -> aSource

select_ :: C_Select a b => [Att32] -> [b] -> aSource

_small :: C_Small a b => [b] -> aSource

small_ :: C_Small a b => [Att11] -> [b] -> aSource

_span :: C_Span a b => [b] -> aSource

span_ :: C_Span a b => [Att11] -> [b] -> aSource

_strong :: C_Strong a b => [b] -> aSource

strong_ :: C_Strong a b => [Att11] -> [b] -> aSource

_style :: C_Style a b => [b] -> aSource

style_ :: C_Style a b => [Att8] -> [b] -> aSource

_sub :: C_Sub a b => [b] -> aSource

sub_ :: C_Sub a b => [Att11] -> [b] -> aSource

_sup :: C_Sup a b => [b] -> aSource

sup_ :: C_Sup a b => [Att11] -> [b] -> aSource

_table :: C_Table a b => [b] -> aSource

table_ :: C_Table a b => [Att41] -> [b] -> aSource

_tbody :: C_Tbody a b => [b] -> aSource

tbody_ :: C_Tbody a b => [Att42] -> [b] -> aSource

_td :: C_Td a b => [b] -> aSource

td_ :: C_Td a b => [Att44] -> [b] -> aSource

_textarea :: C_Textarea a b => [b] -> aSource

textarea_ :: C_Textarea a b => [Att36] -> [b] -> aSource

_tfoot :: C_Tfoot a b => [b] -> aSource

tfoot_ :: C_Tfoot a b => [Att42] -> [b] -> aSource

_th :: C_Th a b => [b] -> aSource

th_ :: C_Th a b => [Att44] -> [b] -> aSource

_thead :: C_Thead a b => [b] -> aSource

thead_ :: C_Thead a b => [Att42] -> [b] -> aSource

_title :: C_Title a b => [b] -> aSource

title_ :: C_Title a b => [Att2] -> [b] -> aSource

_tr :: C_Tr a b => [b] -> aSource

tr_ :: C_Tr a b => [Att42] -> [b] -> aSource

_tt :: C_Tt a b => [b] -> aSource

tt_ :: C_Tt a b => [Att11] -> [b] -> aSource

_ul :: C_Ul a b => [b] -> aSource

ul_ :: C_Ul a b => [Att11] -> [b] -> aSource

_var :: C_Var a b => [b] -> aSource

var_ :: C_Var a b => [Att11] -> [b] -> aSource

Attributes

http_equiv_att :: A_Http_equiv a => String -> aSource

http_equiv_att_bs :: A_Http_equiv a => ByteString -> aSource

content_att :: A_Content a => String -> aSource

content_att_bs :: A_Content a => ByteString -> aSource

nohref_att :: A_Nohref a => String -> aSource

onkeydown_att :: A_Onkeydown a => String -> aSource

onkeydown_att_bs :: A_Onkeydown a => ByteString -> aSource

onkeyup_att :: A_Onkeyup a => String -> aSource

onkeyup_att_bs :: A_Onkeyup a => ByteString -> aSource

onreset_att :: A_Onreset a => String -> aSource

onreset_att_bs :: A_Onreset a => ByteString -> aSource

onmouseup_att :: A_Onmouseup a => String -> aSource

onmouseup_att_bs :: A_Onmouseup a => ByteString -> aSource

scope_att :: A_Scope a => ScopeEnum -> aSource

onmouseover_att :: A_Onmouseover a => String -> aSource

onmouseover_att_bs :: A_Onmouseover a => ByteString -> aSource

align_att :: A_Align a => AlignEnum -> aSource

lang_att :: A_Lang a => String -> aSource

lang_att_bs :: A_Lang a => ByteString -> aSource

valign_att :: A_Valign a => ValignEnum -> aSource

name_att :: A_Name a => String -> aSource

name_att_bs :: A_Name a => ByteString -> aSource

charset_att :: A_Charset a => String -> aSource

charset_att_bs :: A_Charset a => ByteString -> aSource

scheme_att :: A_Scheme a => String -> aSource

scheme_att_bs :: A_Scheme a => ByteString -> aSource

accept_charset_att :: A_Accept_charset a => String -> aSource

accept_charset_att_bs :: A_Accept_charset a => ByteString -> aSource

onmousedown_att :: A_Onmousedown a => String -> aSource

onmousedown_att_bs :: A_Onmousedown a => ByteString -> aSource

rev_att :: A_Rev a => String -> aSource

rev_att_bs :: A_Rev a => ByteString -> aSource

span_att :: A_Span a => String -> aSource

span_att_bs :: A_Span a => ByteString -> aSource

title_att :: A_Title a => String -> aSource

title_att_bs :: A_Title a => ByteString -> aSource

onclick_att :: A_Onclick a => String -> aSource

onclick_att_bs :: A_Onclick a => ByteString -> aSource

width_att :: A_Width a => String -> aSource

width_att_bs :: A_Width a => ByteString -> aSource

enctype_att :: A_Enctype a => String -> aSource

enctype_att_bs :: A_Enctype a => ByteString -> aSource

ismap_att :: A_Ismap a => String -> aSource

usemap_att :: A_Usemap a => String -> aSource

usemap_att_bs :: A_Usemap a => ByteString -> aSource

coords_att :: A_Coords a => String -> aSource

coords_att_bs :: A_Coords a => ByteString -> aSource

frame_att :: A_Frame a => FrameEnum -> aSource

size_att :: A_Size a => String -> aSource

size_att_bs :: A_Size a => ByteString -> aSource

onblur_att :: A_Onblur a => String -> aSource

onblur_att_bs :: A_Onblur a => ByteString -> aSource

datetime_att :: A_Datetime a => String -> aSource

datetime_att_bs :: A_Datetime a => ByteString -> aSource

dir_att :: A_Dir a => DirEnum -> aSource

summary_att :: A_Summary a => String -> aSource

summary_att_bs :: A_Summary a => ByteString -> aSource

method_att :: A_Method a => MethodEnum -> aSource

standby_att :: A_Standby a => String -> aSource

standby_att_bs :: A_Standby a => ByteString -> aSource

tabindex_att :: A_Tabindex a => String -> aSource

tabindex_att_bs :: A_Tabindex a => ByteString -> aSource

style_att :: A_Style a => String -> aSource

style_att_bs :: A_Style a => ByteString -> aSource

onmousemove_att :: A_Onmousemove a => String -> aSource

onmousemove_att_bs :: A_Onmousemove a => ByteString -> aSource

height_att :: A_Height a => String -> aSource

height_att_bs :: A_Height a => ByteString -> aSource

codetype_att :: A_Codetype a => String -> aSource

codetype_att_bs :: A_Codetype a => ByteString -> aSource

char_att :: A_Char a => String -> aSource

char_att_bs :: A_Char a => ByteString -> aSource

multiple_att :: A_Multiple a => String -> aSource

codebase_att :: A_Codebase a => String -> aSource

codebase_att_bs :: A_Codebase a => ByteString -> aSource

xmlns_att :: A_Xmlns a => String -> aSource

xmlns_att_bs :: A_Xmlns a => ByteString -> aSource

profile_att :: A_Profile a => String -> aSource

profile_att_bs :: A_Profile a => ByteString -> aSource

rel_att :: A_Rel a => String -> aSource

rel_att_bs :: A_Rel a => ByteString -> aSource

onsubmit_att :: A_Onsubmit a => String -> aSource

onsubmit_att_bs :: A_Onsubmit a => ByteString -> aSource

ondblclick_att :: A_Ondblclick a => String -> aSource

ondblclick_att_bs :: A_Ondblclick a => ByteString -> aSource

axis_att :: A_Axis a => String -> aSource

axis_att_bs :: A_Axis a => ByteString -> aSource

cols_att :: A_Cols a => String -> aSource

cols_att_bs :: A_Cols a => ByteString -> aSource

abbr_att :: A_Abbr a => String -> aSource

abbr_att_bs :: A_Abbr a => ByteString -> aSource

onchange_att :: A_Onchange a => String -> aSource

onchange_att_bs :: A_Onchange a => ByteString -> aSource

readonly_att :: A_Readonly a => String -> aSource

href_att :: A_Href a => String -> aSource

href_att_bs :: A_Href a => ByteString -> aSource

media_att :: A_Media a => String -> aSource

media_att_bs :: A_Media a => ByteString -> aSource

id_att :: A_Id a => String -> aSource

id_att_bs :: A_Id a => ByteString -> aSource

for_att :: A_For a => String -> aSource

for_att_bs :: A_For a => ByteString -> aSource

src_att :: A_Src a => String -> aSource

src_att_bs :: A_Src a => ByteString -> aSource

value_att :: A_Value a => String -> aSource

value_att_bs :: A_Value a => ByteString -> aSource

data_att :: A_Data a => String -> aSource

data_att_bs :: A_Data a => ByteString -> aSource

hreflang_att :: A_Hreflang a => String -> aSource

hreflang_att_bs :: A_Hreflang a => ByteString -> aSource

checked_att :: A_Checked a => String -> aSource

declare_att :: A_Declare a => String -> aSource

onkeypress_att :: A_Onkeypress a => String -> aSource

onkeypress_att_bs :: A_Onkeypress a => ByteString -> aSource

label_att :: A_Label a => String -> aSource

label_att_bs :: A_Label a => ByteString -> aSource

class_att :: A_Class a => String -> aSource

class_att_bs :: A_Class a => ByteString -> aSource

type_att :: A_Type a => String -> aSource

shape_att :: A_Shape a => ShapeEnum -> aSource

accesskey_att :: A_Accesskey a => String -> aSource

accesskey_att_bs :: A_Accesskey a => ByteString -> aSource

headers_att :: A_Headers a => String -> aSource

headers_att_bs :: A_Headers a => ByteString -> aSource

disabled_att :: A_Disabled a => String -> aSource

rules_att :: A_Rules a => RulesEnum -> aSource

rows_att :: A_Rows a => String -> aSource

rows_att_bs :: A_Rows a => ByteString -> aSource

onfocus_att :: A_Onfocus a => String -> aSource

onfocus_att_bs :: A_Onfocus a => ByteString -> aSource

colspan_att :: A_Colspan a => String -> aSource

colspan_att_bs :: A_Colspan a => ByteString -> aSource

rowspan_att :: A_Rowspan a => String -> aSource

rowspan_att_bs :: A_Rowspan a => ByteString -> aSource

defer_att :: A_Defer a => String -> aSource

cellspacing_att :: A_Cellspacing a => String -> aSource

cellspacing_att_bs :: A_Cellspacing a => ByteString -> aSource

charoff_att :: A_Charoff a => String -> aSource

charoff_att_bs :: A_Charoff a => ByteString -> aSource

cite_att :: A_Cite a => String -> aSource

cite_att_bs :: A_Cite a => ByteString -> aSource

maxlength_att :: A_Maxlength a => String -> aSource

maxlength_att_bs :: A_Maxlength a => ByteString -> aSource

onselect_att :: A_Onselect a => String -> aSource

onselect_att_bs :: A_Onselect a => ByteString -> aSource

accept_att :: A_Accept a => String -> aSource

accept_att_bs :: A_Accept a => ByteString -> aSource

archive_att :: A_Archive a => String -> aSource

archive_att_bs :: A_Archive a => ByteString -> aSource

alt_att :: A_Alt a => String -> aSource

alt_att_bs :: A_Alt a => ByteString -> aSource

classid_att :: A_Classid a => String -> aSource

classid_att_bs :: A_Classid a => ByteString -> aSource

longdesc_att :: A_Longdesc a => String -> aSource

longdesc_att_bs :: A_Longdesc a => ByteString -> aSource

onmouseout_att :: A_Onmouseout a => String -> aSource

onmouseout_att_bs :: A_Onmouseout a => ByteString -> aSource

space_att :: A_Space a => String -> aSource

border_att :: A_Border a => String -> aSource

border_att_bs :: A_Border a => ByteString -> aSource

onunload_att :: A_Onunload a => String -> aSource

onunload_att_bs :: A_Onunload a => ByteString -> aSource

onload_att :: A_Onload a => String -> aSource

onload_att_bs :: A_Onload a => ByteString -> aSource

action_att :: A_Action a => String -> aSource

action_att_bs :: A_Action a => ByteString -> aSource

cellpadding_att :: A_Cellpadding a => String -> aSource

cellpadding_att_bs :: A_Cellpadding a => ByteString -> aSource

valuetype_att :: A_Valuetype a => ValuetypeEnum -> aSource

selected_att :: A_Selected a => String -> aSource

Enumerated Attribute Values

data ValuetypeEnum Source

Constructors

Data 
Ref 
Object 

Instances

data RulesEnum Source

Constructors

None 
Groups 
Rows 
Cols 
All 

Instances

data ShapeEnum Source

Constructors

Rect 
Circle 
Poly 
Default 

Instances

data MethodEnum Source

Constructors

Get 
Post 

Instances

data DirEnum Source

Constructors

Ltr 
Rtl 

Instances

data FrameEnum Source

Constructors

Void 
Above 
Below 
Hsides 
Lhs 
Rhs 
Vsides 
Box 
Border 

Instances

data ValignEnum Source

Constructors

Top 
Middle 
Bottom 
Baseline 

Instances

data AlignEnum Source

Constructors

Left 
Center 
Right 
Justify 
Char 

Instances

data ScopeEnum Source

Constructors

Row 
Col 
Rowgroup 
Colgroup 

Instances