Module spug.web.html

This is yet another Python wrapper around HTML.

This solution aims for simplicity and consistency above all else. All of the tag classes accept sequence and keyword arguments in their constructors: the sequence arguments are always placed in the contents of the tag, the keyword arguments are always used as attributes to the tag.

If a sequence argument is a list or tuple, it is recursively flattened into a string. All other arguments are stringified.

Classes prefaced by the letter "X" are extensions to the basic html classes and do not neccessarily correspond to the rule identified above. Typically, they try to adhere to these rules as much as possible, and offer exceptions so that these objects can be easier to use.

This module currently include lowercase functional forms of many of these classes: they exist only for backwards compatibility and their use is deprecated.

Classes

Functions

_attrs(kw)

def _attrs(kw):

_str(obj)

def _str(obj):

tag(tag, parms, kw)

def tag(tag, parms, kw):

ol(*parms, **kw)

def ol(*parms, **kw):

ul(*parms, **kw)

def ul(*parms, **kw):

li(*parms, **kw)

def li(*parms, **kw):

table(*parms, **kw)

def table(*parms, **kw):

tr(*parms, **kw)

def tr(*parms, **kw):

td(*parms, **kw)

def td(*parms, **kw):

h1(*parms, **kw)

def h1(*parms, **kw):

h2(*parms, **kw)

def h2(*parms, **kw):

h3(*parms, **kw)

def h3(*parms, **kw):

h4(*parms, **kw)

def h4(*parms, **kw):

h5(*parms, **kw)

def h5(*parms, **kw):

h6(*parms, **kw)

def h6(*parms, **kw):

h7(*parms, **kw)

def h7(*parms, **kw):

h8(*parms, **kw)

def h8(*parms, **kw):

h9(*parms, **kw)

def h9(*parms, **kw):

p(*parms, **kw)

def p(*parms, **kw):

body(*parms, **kw)

def body(*parms, **kw):

a(*parms, **kw)

def a(*parms, **kw):

title(*parms, **kw)

def title(*parms, **kw):

head(*parms, **kw)

def head(*parms, **kw):

html(*parms, **kw)

def html(*parms, **kw):

form(*parms, **kw)

def form(*parms, **kw):

center(*parms, **kw)

def center(*parms, **kw):

font(*parms, **kw)

def font(*parms, **kw):

input(*parms, **kw)

def input(*parms, **kw):

x_ul(*parms, **kw)

def x_ul(*parms, **kw):

Like "ul" only converts each positional parameter to a list item.

x_ol(*parms, **kw)

def x_ol(*parms, **kw):

Like "ol" only converts each positional parameter to a list item.

x_htmldoc(*parms, **kw)

def x_htmldoc(*parms, **kw):

Returns a complete HTML document. Keyword arguments all go into the body tag, except for the following special arguments:

title

Becomes the title of the document.

x_text(*parms, **kw)

def x_text(*parms, **kw):

x_submit(*parms, **kw)

def x_submit(*parms, **kw):

doc(*parms, **kw)

def doc(*parms, **kw):

_writeList(list, dest)

def _writeList(list, dest):