Welcome to Xierpa. This is the stable 1.2 version which was developed by Petr van Blokland + Claudia Mens (buro@petr.com) and is maintained by Michiel Kauw-A-Tjoe. It is subclassed by the Museum Meermanno and American Express applications.

HtmlBuilder

The XierpaBuilder class implements the standard XHTML tag set with all attributes. No additional whitespace is added.

An overview

The HtmlBuilder class contains the following tags:
Open tagClose tagAttributesDocstring or default value
AREA_ATTRIBUTES
Mutable set class.
AREA_ATTRIBUTES_DEFAULTS {'width': 600, 'height': 400}
AUDIO_ATTRIBUTES
Mutable set class.
A_ATTRIBUTES
Mutable set class.
A_ATTRIBUTES_DEFAULTS {'alt': '='}
BODY_ATTRIBUTES
Mutable set class.
BOOLEAN_ATTRIBUTES {'disabled': 'disabled', 'selected': 'selected', 'checked': 'checked', 'controls': 'controls', 'autoplay': 'autoplay'}
BR_ATTRIBUTES
Mutable set class.
B_ATTRIBUTES
Mutable set class.
DIV_ATTRIBUTES
Mutable set class.
EMBED_ATTRIBUTES
Mutable set class.
FRAMESET_ATTRIBUTES
Mutable set class.
FRAME_ATTRIBUTES
Mutable set class.
H1_ATTRIBUTES
Mutable set class.
H2_ATTRIBUTES
Mutable set class.
H3_ATTRIBUTES
Mutable set class.
H4_ATTRIBUTES
Mutable set class.
H5_ATTRIBUTES
Mutable set class.
H6_ATTRIBUTES
Mutable set class.
HR_ATTRIBUTES
Mutable set class.
HTML_ATTRIBUTES
Mutable set class.
H_ATTRIBUTES
Mutable set class.
IFRAME_ATTRIBUTES
Mutable set class.
IMG_ATTRIBUTES
Mutable set class.
IMG_ATTRIBUTES_DEFAULTS {'alt': '$'}
INPUT_ATTRIBUTES
Mutable set class.
INPUT_ATTRIBUTES_DEFAULTS {'disabled': False, 'alt': '+'}
LINK_ATTRIBUTES
Mutable set class.
LI_ATTRIBUTES
Mutable set class.
META_ATTRIBUTES
Mutable set class.
NOFRAMES_ATTRIBUTES
Mutable set class.
OBJECT_ATTRIBUTES
Mutable set class.
OL_ATTRIBUTES
Mutable set class.
OPTGROUP_ATTRIBUTES
Mutable set class.
OPTION_ATTRIBUTES
Mutable set class.
PARAM_ATTRIBUTES
Mutable set class.
P_ATTRIBUTES
Mutable set class.
Q_ATTRIBUTES
Mutable set class.
SELECT_ATTRIBUTES
Mutable set class.
SMALL_ATTRIBUTES
Mutable set class.
SOURCE_ATTRIBUTES
Mutable set class.
SPAN_ATTRIBUTES
Mutable set class.
STRONG_ATTRIBUTES
Mutable set class.
SUB_ATTRIBUTES
Mutable set class.
SUP_ATTRIBUTES
Mutable set class.
S_ATTRIBUTES
Mutable set class.
TABLE_ATTRIBUTES
Mutable set class.
TBODY_ATTRIBUTES
Mutable set class.
TD_ATTRIBUTES
Mutable set class.
TEXTAREA_ATTRIBUTES
Mutable set class.
TFOOT_ATTRIBUTES
Mutable set class.
THEAD_ATTRIBUTES
Mutable set class.
TH_ATTRIBUTES
Mutable set class.
TR_ATTRIBUTES
Mutable set class.
UL_ATTRIBUTES
Mutable set class.
U_ATTRIBUTES
Mutable set class.
a _a
The a tag defines an anchor. An anchor can be used in two ways:
  • To create a link to another document by using the href attribute
  • To create a bookmark inside a document, by using the name or id attribute
Todo: Add missing attributes
See also: http://www.w3schools.com/tags/tag_a.asp

Python example
self.a(href='http://www.xierpa.com', class_='navigationlink'
...
self._a()


area
audio _audio
The audio tag defines an audio element.
See also: http://www.w3schools.com/html5/tag_audio.asp
HTML5 only.

Python example
self.audio(controls="controls", autoplay="autoplay", style="width:200px")
...
self._audio()


b _b
The b tag is the standard XHTML bold. Note that nowadays it is better to implement this typographic behaviour through span and CSS.
Todo: Add the other attributes to the b tag such as: id, class, title, style, dir, lang, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
See also: http://www.w3schools.com/tags/tag_font_style.asp

blockquote _blockquote
The blockquote tag is the standard XHTML tag.
body _body
The body element defines the documents' body. It contains all the contents of the document (like text, images, colors, graphics, etc.).
See also: http://www.w3schools.com/tags/tag_body.asp

Python example
self.body(onload='javascript:loadpage()')
...
self._body()


br count
The br tag inserts a single line break.
The count attribute is not standard XHTML. It indicates the number of br to repeat.
The class_ can define the amount of leading in px of the break.
See also: http://www.w3schools.com/tags/tag_br.asp

Python example
self.br()


div _div
The div tag defines a division/section in a document.
Note: Browsers usually place a line break before and after the div element.
See also: http://www.w3schools.com/tags/tag_div.asp

Python example
self.div()
...
self._div()


embed
Does not seem to be defined in w3schools??
Python example
self.embed(src='./_images/amovie.qt')


form _form action
class_
enctype
id
method
name
onreset
onsubmit
style
target
The form element creates a form for user input. A form can contain textfields, checkboxes, radio-buttons and more. Forms are used to pass user-data to a specified URL.
See also: http://www.w3schools.com/tags/tag_form.asp

Python example
self.form(action=e['path'])
...
self._form()


frame _frame
The frame tag defines one particular window (frame) within a frameset. Each frame in a frameset can have different attributes, such as border, scrolling, the ability to resize, etc. See also: http://www.w3schools.com/tags/tag_frame.asp

frameset _frameset
The frameset tag creates an frame set that contains frames with other documents. See also: http://www.w3schools.com/tags/tag_frameset.asp

get_attribute_exceptions key
value
The get_attribute_exceptions method writes the attribute, and checks on naming differences between the Xierpa attributes and HTML attributes.
getandwrite_attributes args
tagname
getclassname args
attributes
h1 _h1
The h1 to h6 tags define headers.  h1 defines the largest header. h6 defines the smallest header.
See also: http://www.w3schools.com/tags/tag_hn.asp

Python example
self.h1(class_='chapter')
...
self._h1()


h1_ s
The h1_ to h6_ tags define headers, combining the opening and closing tag where the s attribute is the block content.
h2 _h2
The h1 to h6 tags define headers.  h1 defines the largest header. h6 defines the smallest header.
See also: http://www.w3schools.com/tags/tag_hn.asp

Python example
self.h2(class_='head')
...
self._h2()


h2_ s
The h1_ to h6_ tags define headers, combining the opening and closing tag where the s attribute is the block content.
h3 _h3
The h1 to h6 tags define headers.  h1 defines the largest header. h6 defines the smallest header.
See also: http://www.w3schools.com/tags/tag_hn.asp

Python example
self.h3(class_='subhead')
...
self._h3()


h3_ s
The h1_ to h6_ tags define headers, combining the opening and closing tag where the s attribute is the block content.
h4 _h4
The h1 to h6 tags define headers.  h1 defines the largest header. h6 defines the smallest header.
See also: http://www.w3schools.com/tags/tag_hn.asp

Python example
self.h4(class_='subsubhead')
...
self._h4()


h4_ s
The h1_ to h6_ tags define headers, combining the opening and closing tag where the s attribute is the block content.
h5 _h5
The h1 to h6 tags define headers.  h1 defines the largest header. h6 defines the smallest header.
See also: http://www.w3schools.com/tags/tag_hn.asp

Python example
self.h5(class_='caption')
...
self._h5()


h5_ s
The h1_ to h6_ tags define headers, combining the opening and closing tag where the s attribute is the block content.
h6 _h6
The h1 to h6 tags define headers.  h1 defines the largest header. h6 defines the smallest header.
See also: http://www.w3schools.com/tags/tag_hn.asp

Python example
self.h6(class_='footnote')
...
self._h6()


h6_ s
The h1_ to h6_ tags define headers, combining the opening and closing tag where the s attribute is the block content.
head _head
The head element can contain information about the document. The browser does not display the "head information" to the user. The following tags can be in the head section: base, link, meta, script, style and title.
See also: http://www.w3schools.com/tags/tag_head.asp

Python example
self.head()
...
self._head()


hr
The hr tag inserts a horizontal rule.
See also: http://www.w3schools.com/tags/tag_hr.asp

Python example
self.hr(size=15, color='green')


html _html xmlns
See also: http://www.w3schools.com/tags/tag_html.asp

Python example
self.html(xmlns="http://www.w3.org/1999/xhtml", dir=ltr, lang=no, xmllang=no )
...
self._html()

Default value for xmlns is "http://www.w3.org/1999/xhtml".
i _i
The i tag is the standard XHTML italic. Note that nowadays it is better to implement this typographic behaviour through span and CSS.
Todo: Add the other attributes to the p tag such as: id, class, title, style, dir, lang, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
See also: http://www.w3schools.com/tags/tag_font_style.asp

iframe src
The iframe tag creates an inline frame that contains another document. See also: http://www.w3schools.com/tags/tag_iframe.asp

img
The img tag defines an image. The img tag has no block.
See also: http://www.w3schools.com/tags/tag_img.asp

Python example
self.img(src='./_image/animage.png', width=100)


input
The input tag defines the start of an input field where the user can enter data.
The attribute type can be one of button | checkbox | file | hidden | image | password | radio | reset | submit | text.
See also: http://www.w3schools.com/tags/tag_input.asp

Python example
self.input(type='checkbox', name='mycheckbox')


li _li
The li tag defines the start of a list item. The li tag is used in both ordered (ol) and unordered lists (ul). See also: http://www.w3schools.com/tags/tag_li.asp

Python example
self.li()
...
self._li()


link
The link tag defines the relationship between two linked documents.
Note that this tag is defined by XierpaBuilder. When using an inheriting class from XierpaBuilder then use the rellink tag name instead.
See also: http://www.w3schools.com/tags/tag_link.asp

Python example
self.head()
...
self.link(href='./_images/favicon.ico', rel='shortcut icon')
...
self._head()


map _map name
meta
The meta element provides meta-information about your page, such as descriptions and keywords for search engines and refresh rates.
See also: http://www.w3schools.com/tags/tag_meta.asp

Python example
self.meta()
...
self._meta()


noframes _noframes
The noframes tag is used for browsers that do not handle frames.
The noframes element can contain all the elements that you can find inside the body element of a normal HTML page.
The noframes element is most used to link to a non-frameset version of the web site or to display a message to users that frames are required.
The noframes element goes inside the frameset element.
See also: http://www.w3schools.com/tags/tag_noframes.asp

object _object
The object defines an embedded object. Use this element to add multimedia to your XHTML page. This element allows you to specify the data and parameters for objects inserted into HTML documents, and the code that can be used to display/manipulate that data.
ol _ol
The ol tag defines the start of an ordered list.
See also: http://www.w3schools.com/tags/tag_ol.asp

Python example
self.ol()
...
self._ol()


optgroup _optgroup
The optgroup tag defines an option group in the drop-down list.
See also: http://www.w3schools.com/tags/tag_optgroup.asp

Python example
self.optgroup()
...
self._optgroup()


option _option
The option tag defines an option in the drop-down list.
See also: http://www.w3schools.com/tags/tag_option.asp

Python example
self.option()
...
self._option()


p _p
The p tag is the standard XHTML paragraph. Todo: Add the other attributes to the p tag such as: id, class, title, style, dir, lang, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
See also: http://www.w3schools.com/tags/tag_p.asp

param
The param element allows you to specify the run-time settings for an object inserted into XHTML documents.
pre _pre width
The pre element defines preformatted text. The text enclosed in the pre element usually preserves spaces and line breaks. The text renders in a fixed-pitch font.
The width attribute defines the maximum number of characters per line (usually 40, 80, or 132).
See also: http://www.w3schools.com/tags/tag_pre.asp

Python example
self.pre()
...
self._pre()


q _q
The q tag defines the start of a short quotation. Note that nowadays it is better to implement this typographic behaviour through span and CSS.
Todo: Add the other attributes to the p tag such as: id, class, title, style, dir, lang, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
See also: http://www.w3schools.com/tags/tag_q.asp

s _s
The s tag is the standard XHTML strike. Note that nowadays it is better to implement this typographic behaviour through span and CSS.
Todo: Add the other attributes to the p tag such as: id, class, title, style, dir, lang, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
See also: http://www.w3schools.com/tags/tag_strike.asp

script _script charset
language
src
type
The br tag inserts a single line break.
Defines a script, such as a JavaScript. Note that if @src is used, then no self._script() must be used. The count attribute is not standard XHTML. It indicates the number of br to repeat.
See also: http://www.w3schools.com/tags/tag_script.asp

Python example
self.script()
...
self._script()


select _select
The select element creates a drop-down list.
See also: http://www.w3schools.com/tags/tag_select.asp

Python example
self.select()
...
self._select()


small _small
The small tag is the standard XHTML small.
source
The source tag defines a source element of e.g. the audio tag.
HTML5 only.
See also: http://www.w3schools.com/html5/tag_source.asp

Python example
self.source(src="soundpath.mp3", type="audio/mpeg")


span _span
strong _strong
The strong tag is the standard XHTML strong. Note that nowadays it is better to implement this typographic behaviour through span and CSS.
Todo: Add the other attributes to the b tag such as: id, class, title, style, dir, lang, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
See also: http://www.w3schools.com/tags/tag_font_style.asp

style _style media
type
Defines a style in a document. The style element goes in the head section. If you want to include a style sheet in your page, you should define the style sheet externally, and link to it using XHTML link (note that this tag is redefined in XierpaBuilder.
See also: http://www.w3schools.com/tags/tag_style.asp

Python example
self.style()
...
self._style()


sub _sub
The sub tag implements the standard XTHML tag for inferior (subscript) text.
Python example
self.text('Normal text')
self.sub()
self.text('and inferior')
self._sub()

Normal text and inferior
sup _sup
The sup tag implements the standard XTHML tag for superior (superscript) text.
Python example
self.text('Normal text')
self.sup()
self.text('and superior')
self._sup()

Normal text and suporior
table _table
The table tag defines a table. Inside a table tag you can put table headers, table rows, table cells, and other tables.
See also: http://www.w3schools.com/tags/tag_table.asp

Python example
self.table()
...
self._table()


tbody _tbody
Defines the text body of a table.
td _td
Defines a cell in a table. If the rolspan or colspan are not defined or if their value is 1 then the output is ignored.
See also: http://www.w3schools.com/tags/tag_td.asp

Python example
self.td()
...
self._td()


textarea _textarea
Defines a text-area (a multi-line text input control). A user can write text in the text-area. In a text-area you can write an unlimited number of characters. The default font in the text-area is fixed pitch.
See also: http://www.w3schools.com/tags/tag_textarea.asp

Python example
self.textarea()
...
self._textarea()


tfoot _tfoot
Defines the text footer of a table.
th _th
Defines a table header cell in a table. The text within the th element usually renders in bold. If the rolspan or colspan are not defined or if their value is 1 then the output is ignored.
See also: http://www.w3schools.com/tags/tag_th.asp

Python example
self.th()
...
self._th()


thead _thead
Defines the text header of a table.
title _title
This tag defines the title of the document.
See also: http://www.w3schools.com/tags/tag_title.asp

Python example
self.title()
...
self._title()


tr _tr
Defines a row in a table.
See also: http://www.w3schools.com/tags/tag_tr.asp

Python example
self.tr()
...
self._tr()


u _u
The u tag is the standard XHTML underline. Note that nowadays it is better to implement this typographic behaviour through span and CSS.
Todo: Add the other attributes to the u tag such as: id, class, title, style, dir, lang, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup
See also: http://www.w3schools.com/tags/tag_font_style.asp

ul _ul
The ul tag defines an unordered list.
See also: http://www.w3schools.com/tags/tag_ul.asp

Python example
self.ul()
...
self._ul()


write_attribute key
value
Auxiliary function to write each attribute to self.result.
write_attributes args
attributes
default_attributes
tagname
Generic function to write HTML attributes. The new HTML5 feature to store custom data inside the attribute 'data-xxx' is defined as attribute name data_xxx. See http://ejohn.org/blog/html-5-data-attributes/.
write_tag args
open
tagname
Writes a normally formatted HTML tag, exceptions have a custom implementation, see respective functions.