dk.html package

Submodules

dk.html.css module

class dk.html.css.css(**attrs)[source]

Bases: dk.collections.pset.pset

dk.html.html module

HTML helper file.

class dk.html.html.a(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.abbr(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.acronym(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.address(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.applet(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.area(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.b(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.base(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.bdo(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.big(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.blockquote(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.body(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.bokmaal

alias of link

class dk.html.html.br(**kw)

Bases: dk.html.html.xtag

class dk.html.html.bsefont(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.button(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.caption(*content, **kw)

Bases: dk.html.html.dtag

class dk.html.html.center(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.checkbox_input

alias of input

class dk.html.html.cite(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.closetag(tag_name, *content, **kw)[source]

Bases: dk.html.html.tag

flatten(lst=None)[source]
class dk.html.html.code(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.col(**kw)

Bases: dk.html.html.xtag

class dk.html.html.colgroup(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.color[source]
aqua = '"#00FFFF"'
black = '"#000000"'
blue = '"#0000FF"'
fuchsia = '"#FF00FF"'
gray = '"#808080"'
green = '"#008000"'
lime = '"#00FF00"'
maroon = '"#800000"'
navy = '"#000080"'
olive = '"#808000"'
purple = '"#800080"'
red = '"#FF0000"'
silver = '"#COCOCO"'
teal = '"#008080"'
white = '"#FFFFFF"'
yellow = '"#FFFF00"'
class dk.html.html.dd(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.del_

alias of del

class dk.html.html.dfn(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.dir_

alias of dir

class dk.html.html.div(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.dl(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.doctype

alias of DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"     "http://www.w3.org/TR/html4/strict.dtd"

dk.html.html.doctype401frameset

alias of DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"     "http://www.w3.org/TR/html4/frameset.dtd"

dk.html.html.doctype401strict

alias of DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"     "http://www.w3.org/TR/html4/strict.dtd"

dk.html.html.doctype401transitional

alias of DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"     "http://www.w3.org/TR/html4/loose.dtd"

class dk.html.html.dt(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.dtag(tag_name, *content, **kw)[source]

Bases: dk.html.html.tag

d(issappearing)tag: if the content is empty, i.e. self.content == (‘’,) this tag doesn’t output anything at all. Useful for legends, table captions, etc.

class dk.html.html.em(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.english

alias of link

dk.html.html.escape(strval, enc=None)[source]

Convert string s (potentially unicode) to a ascii string with entitydefs like ø æ etc.

dk.html.html.escape_char(unichar)[source]
dk.html.html.escaped_array(strval)[source]

Convert unicode string to list of ascii characters or entitydefs like ø etc.

class dk.html.html.fieldset(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.font(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.form(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.frame(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.frameset(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.h1(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.h2(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.h3(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.h4(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.h5(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.h6(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.head(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.hidden_input

alias of input

class dk.html.html.hr(**kw)

Bases: dk.html.html.xtag

class dk.html.html.html(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.i(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.iframe(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.img(**kw)

Bases: dk.html.html.xtag

class dk.html.html.input(**kw)

Bases: dk.html.html.xtag

class dk.html.html.ins(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.kbd(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.label(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.legend(*content, **kw)

Bases: dk.html.html.dtag

class dk.html.html.li(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.lines(*content)[source]

Bases: dk.html.html.text

like text, except each item in content is separated with a <br> tag.

flatten()[source]

Bases: dk.html.html.xtag

class dk.html.html.map(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.menu(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.meta(**kw)

Bases: dk.html.html.xtag

dk.html.html.mkdtag(name, **attrs)[source]
dk.html.html.mkstag(name)[source]
dk.html.html.mktag(name, _parent=<class 'dk.html.html.tag'>, _nlafter=False, **attrs)[source]
dk.html.html.mkxtag(name, **attrs)[source]
dk.html.html.next

alias of link

class dk.html.html.nobr(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.noframes(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.norm_attr_name(attr)[source]
dk.html.html.normalize(v)[source]

returns a stringified unicode version of v

dk.html.html.norsk

alias of link

class dk.html.html.noscript(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.nynorsk

alias of link

dk.html.html.object_

alias of object

class dk.html.html.ol(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.opentag(tag_name, *content, **kw)[source]

Bases: dk.html.html.tag

flatten(lst=None)[source]
class dk.html.html.optgroup(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.option(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.p(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.page(xtitle, abody)[source]

Shortcut to get a page up quickly.

class dk.html.html.param(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.password_input

alias of input

dk.html.html.pdf

alias of link

dk.html.html.plain_attribute(strval, legal='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._:')[source]
class dk.html.html.pre(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.prev

alias of link

class dk.html.html.q(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.quote(strval)
dk.html.html.quote_if_needed(strval)[source]
dk.html.html.quote_smart(strval)[source]
dk.html.html.quote_xhtml(v)[source]
dk.html.html.radio_input

alias of input

dk.html.html.rawstr2unicode(strval)[source]
class dk.html.html.s(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.samp(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.script(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.select(options, selected=None, **kw)[source]

Bases: dk.html.html.tag

options
selected
values
class dk.html.html.small(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.span(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.sqlresult(res, desc=None, **kw)[source]

Bases: dk.html.html.tag

class dk.html.html.stag(tag_name, **kw)[source]

Bases: dk.html.html.xtag

s(ingle)tag

dk.html.html.start

alias of link

class dk.html.html.strike(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.strong(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.style(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.stylesheet

alias of link

class dk.html.html.sub(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.submit_button

alias of input

class dk.html.html.sup(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.table(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.tabledesc(*cols)[source]

Bases: object

class dk.html.html.tag(tag_name, *content, **kw)[source]

Bases: dk.html.html.xtag

Regular tag: outputs an open tag with attributes, followed by its contents, followed by a closing tag.

Attributes can be set either as keyword arguments in the constructor or by assigning to attributes of the object.

Content can be any combination of items, iterables, and generators:

>>> table(tr(td(i) for i in range(5)), tr(td(i**i) for i in range(5)))
<table><tr><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td></tr>
<tr><td>1</td><td>1</td><td>4</td><td>27</td><td>256</td></tr>
</table>

NB: Attributes that conflict with Python keywords have an underline appended, e.g.: mytag.class_ = ...

close_tag()[source]
flatten(lst=None)[source]
open_tag()[source]
xcontent
class dk.html.html.tbody(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.td(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.text(*content)[source]

Bases: dk.html.html.tag

text tag: outputs its contents without any tags around it. Useful for grouping at the top level.

flatten()[source]
dk.html.html.text_input

alias of input

class dk.html.html.textarea(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.tfoot(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.th(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.thead(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.title(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.tr(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.tt(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.u(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.u8escape(strval)[source]
class dk.html.html.ul(*content, **kw)

Bases: dk.html.html.tag

dk.html.html.unescape(txt)[source]

Convert text containing entitydefs into Unicode.

class dk.html.html.var(*content, **kw)

Bases: dk.html.html.tag

class dk.html.html.xtag(tag_name, **kw)[source]

Bases: object

x(ml-style)tag: a tag without content or a closing tag.

E.g. <br/> would be xtag(‘br’)

[2009-03-11]
w3 validator complains that 4.01 loose should not use <foo /> but <foo>.
attributes()[source]

return a string like key=”val”.

flatten()[source]

dk.html.theme module

Attempt at defining themes from Python (probably better to do this elsewhere).

dk.html.theme.mkpalette(_source, base, colorlist)[source]

Convenience function to define a palette.

class dk.html.theme.palette[source]

Color palettes from http://colormatch.dk. Colors are named with a lower case x in front of the nearest defined colorvalue.

class LightSkyBlue2[source]
Gray7 = '#121212'
Gray93 = '#ededed'
LightSkyBlue2 = '#a4d3ee'
get = ['#a4d3ee', '#6f8ea1', '#edd7a4', '#a1896f', '#121212', '#ededed']
xLemonChiffon4 = '#a1896f'
xLightSlateGray = '#6f8ea1'
xNavajoWhite2 = '#edd7a4'
class palette.xForrestGreen[source]
Gray48 = '#7a7a7a'
Gray52 = '#858585'
get = ['#257b24', '#3cc73a', '#5f7a23', '#9ac73a', '#858585', '#7a7a7a']
xForrestGreen = '#257b24'
xLimeGreen = '#3cc73a'
xOliveDrab4 = '#5f7a23'
xYellowGreen = '#9ac73a'

dk.html.uhtml module

New version of html.py module that works on/with Unicode.

class dk.html.uhtml.EscapedString[source]

Bases: unicode

class dk.html.uhtml.a(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.abbr(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.acronym(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.address(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.applet(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.area(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.b(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.base(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.bdo(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.big(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.blockquote(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.body(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.bokmaal

alias of link

class dk.html.uhtml.br(**kw)

Bases: dk.html.uhtml.xtag

class dk.html.uhtml.bsefont(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.button(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.caption(*content, **kw)

Bases: dk.html.uhtml.dtag

class dk.html.uhtml.center(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.checkbox_input

alias of input

class dk.html.uhtml.cite(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.closetag(tag_name, *content, **kw)[source]

Bases: dk.html.uhtml.tag

flatten(lst=None)[source]
class dk.html.uhtml.code(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.col(**kw)

Bases: dk.html.uhtml.xtag

class dk.html.uhtml.colgroup(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.dd(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.del_

alias of del

class dk.html.uhtml.dfn(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.dir_

alias of dir

class dk.html.uhtml.div(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.dl(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.doctype

alias of DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"     "http://www.w3.org/TR/html4/strict.dtd"

dk.html.uhtml.doctype401frameset

alias of DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"     "http://www.w3.org/TR/html4/frameset.dtd"

dk.html.uhtml.doctype401strict

alias of DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"     "http://www.w3.org/TR/html4/strict.dtd"

dk.html.uhtml.doctype401transitional

alias of DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"     "http://www.w3.org/TR/html4/loose.dtd"

class dk.html.uhtml.dt(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.dtag(tag_name, *content, **kw)[source]

Bases: dk.html.uhtml.tag

d(issappearing)tag: if the content is empty, i.e. self.content == (‘’,) this tag doesn’t output anything at all. Useful for legends, table captions, etc.

class dk.html.uhtml.em(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.english

alias of link

dk.html.uhtml.escape(s, enc=None)[source]

Convert string s (potentially unicode) to a ascii string with entitydefs like &oslash; &aelig; etc.

dk.html.uhtml.escape_char(unichar)[source]
dk.html.uhtml.escaped_array(s)[source]

Convert unicode string to list of ascii characters or entitydefs like &oslash; etc.

class dk.html.uhtml.fieldset(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.font(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.form(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.frame(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.frameset(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.h1(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.h2(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.h3(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.h4(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.h5(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.h6(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.head(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.hidden_input

alias of input

class dk.html.uhtml.hr(**kw)

Bases: dk.html.uhtml.xtag

class dk.html.uhtml.html(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.i(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.iframe(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.img(**kw)

Bases: dk.html.uhtml.xtag

class dk.html.uhtml.input(**kw)

Bases: dk.html.uhtml.xtag

class dk.html.uhtml.ins(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.kbd(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.label(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.legend(*content, **kw)

Bases: dk.html.uhtml.dtag

class dk.html.uhtml.li(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.lines(*content)[source]

Bases: dk.html.uhtml.text

like text, except each item in content is separated with a <br> tag.

flatten()[source]

Bases: dk.html.uhtml.xtag

class dk.html.uhtml.map(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.menu(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.meta(**kw)

Bases: dk.html.uhtml.xtag

dk.html.uhtml.mkdtag(name, **attrs)[source]
dk.html.uhtml.mkstag(name)[source]
dk.html.uhtml.mktag(name, _parent=<class 'dk.html.uhtml.tag'>, _nlafter=False, **attrs)[source]
dk.html.uhtml.mkxtag(name, **attrs)[source]
dk.html.uhtml.next

alias of link

class dk.html.uhtml.nobr(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.noframes(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.norm_attr_name(a)[source]

_foo_bar => _foo_bar, class_ => class, max_height => max-height

>>> norm_attr_name(u'class_')
u'class'
>>> norm_attr_name(u'z_index')
u'z-index'
dk.html.uhtml.normalize(v)[source]

returns a stringified unicode version of v

dk.html.uhtml.norsk

alias of link

class dk.html.uhtml.noscript(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.nynorsk

alias of link

dk.html.uhtml.object_

alias of object

class dk.html.uhtml.ol(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.opentag(tag_name, *content, **kw)[source]

Bases: dk.html.uhtml.tag

flatten(lst=None)[source]
class dk.html.uhtml.optgroup(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.option(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.p(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.param(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.password_input

alias of input

dk.html.uhtml.pdf

alias of link

class dk.html.uhtml.pre(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.prev

alias of link

class dk.html.uhtml.q(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.quote(v)[source]
>>> quote(u"Bjorn's")
u'"Bjorn\'s"'
>>> quote(u'the "best"')
u'"the &quot;best&quot;"'
dk.html.uhtml.radio_input

alias of input

dk.html.uhtml.rawstr2unicode(s)[source]
class dk.html.uhtml.s(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.samp(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.script(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.select(options, selected=None, **kw)[source]

Bases: dk.html.uhtml.tag

options
selected
values
class dk.html.uhtml.small(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.span(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.stag(tag_name, **kw)[source]

Bases: dk.html.uhtml.xtag

s(ingle)tag

dk.html.uhtml.start

alias of link

class dk.html.uhtml.strike(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.strong(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.style(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.stylesheet

alias of link

class dk.html.uhtml.sub(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.submit_button

alias of input

class dk.html.uhtml.sup(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.table(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.tabledesc(*cols)[source]

Bases: object

class dk.html.uhtml.tag(tag_name, *content, **kw)[source]

Bases: dk.html.uhtml.xtag

Regular tag: outputs an open tag with attributes, followed by its contents, followed by a closing tag.

Attributes can be set either as keyword arguments in the constructor or by assigning to attributes of the object.

Content can be any combination of items, iterables, and generators:

>> table(tr(td(i) for i in range(5)), tr(td(i**i) for i in range(5)))

NB: Attributes that conflict with Python keywords have an underline appended, e.g.: mytag.class_ = ...

close_tag()[source]
flatten(lst=None)[source]
open_tag()[source]
xcontent
class dk.html.uhtml.tbody(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.td(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.test_doctest()[source]
>>> br()
u'<br>'
>>> div('hello', b('world'))
u'<div>hello<b>world</b></div>\n'
>>> print select(options=[u'a', u'b'], name='foo')
u'<select name="foo" id="id_foo"><option value="a">a</option>\n<option value="b">b</option>\n</select>'
class dk.html.uhtml.text(*content)[source]

Bases: dk.html.uhtml.tag

text tag: outputs its contents without any tags around it. Useful for grouping at the top level.

flatten()[source]
dk.html.uhtml.text_input

alias of input

class dk.html.uhtml.textarea(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.tfoot(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.th(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.thead(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.title(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.tr(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.tt(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.u(*content, **kw)

Bases: dk.html.uhtml.tag

dk.html.uhtml.u8escape(s)[source]
class dk.html.uhtml.ul(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.var(*content, **kw)

Bases: dk.html.uhtml.tag

class dk.html.uhtml.xtag(tag_name, **kw)[source]

Bases: object

x(ml-style)tag: a tag without content or a closing tag. E.g. <br/> would be xtag(‘br’)

Note

[2009-03-11] w3 validator complains that 4.01 loose should not use <foo /> but <foo>.

attributes()[source]

return a string like key=”val”.

flatten()[source]

Module contents