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.
def _str(obj):
def _attrs(kw):
def tag(tag, parms, kw):
def ul(*parms, **kw):
def ol(*parms, **kw):
def li(*parms, **kw):
def table(*parms, **kw):
def tr(*parms, **kw):
def td(*parms, **kw):
def h1(*parms, **kw):
def h2(*parms, **kw):
def h3(*parms, **kw):
def h4(*parms, **kw):
def h5(*parms, **kw):
def h6(*parms, **kw):
def h7(*parms, **kw):
def h8(*parms, **kw):
def h9(*parms, **kw):
def title(*parms, **kw):
def body(*parms, **kw):
def html(*parms, **kw):
def p(*parms, **kw):
def head(*parms, **kw):
def a(*parms, **kw):
def form(*parms, **kw):
def center(*parms, **kw):
def font(*parms, **kw):
def input(*parms, **kw):
def x_ul(*parms, **kw):
Like "ul" only converts each positional parameter to a list item.
Like "ol" only converts each positional parameter to a list item.
Returns a complete HTML document. Keyword arguments all go into the body
tag, except for the following special arguments:
Becomes the title of the document.
Encodes the string: replacing characters that have special meaning within
HTML. Returns the encoded string.
parms:
[string] data to encode
x_ol(*parms, **kw)
def x_ol(*parms, **kw):
x_htmldoc(*parms, **kw)
def x_htmldoc(*parms, **kw):
x_submit(*parms, **kw)
def x_submit(*parms, **kw):
_fixSpecial(match)
def _fixSpecial(match):
x_text(*parms, **kw)
def x_text(*parms, **kw):
doc(*parms, **kw)
def doc(*parms, **kw):
encode(data)
def encode(data):
_writeList(list, dest)
def _writeList(list, dest):