Previous Next blank.gif blank.gif

Class KBD


SYNOPSIS

import HTMLgen
class KBD(AbstractTag)
  string __module__ = 'HTMLgen'
  dictionary attr_dict = {'id': '', 'style': '', 'c ...
  string attr_template = '%(class)s%(id)s%(style)s'
  tuple attrs = ('class', 'id', 'style')
  string html_escape = 'OFF'
  string tagname = 'KBD'

  # Methods inherited by KBD from AbstractTag
  def __add__(self, other)
  def __call__(self, text)
  def __init__(self, *contents, **kw)
  def __len__(self)
  def __setattr__(self, name, value)
  def __str__(self)
  def append(self, *items)
  def copy(self)
  def empty(self)
  def last(self)
  def markup(self, rex=None, marker=None, **kw)
  def prepend(self, *items)

DESCRIPTION

Keyboard-like input.

def __add__(self, other)

Support self + list

def __call__(self, text)

Enable instances to be callable as text processing functions.

For Example:

  >>> S = HTMLgen.Strong()
  >>> print S('Hi!')
  >>> <STRONG>Hi!</STRONG>

def __len__(self)

Return the integer length of the container list.

def __setattr__(self, name, value)

Intercept attribute assignments.

If the attribute is a legal HTML tag attribute add it to the dict used for substitution in __str__, otherwise just set it as an instance attribute.

def __str__(self)

Generate an HTML formatted string for this object.

def append(self, *items)

Append one or more items to the end of the container.

def copy(self)

Return a full copy of the object.

def empty(self)

Empty the contents of the container.

def last(self)

Return a reference to the last item in the container.

def markup(self, rex=None, marker=None, **kw)

Markup the contained text matching a regular expression with a tag class instance or function.

Arguments

rex
a regular expression object or pattern which will be used to match all text patterns in the Paragraph body. Must have a single group defined. Group 1 is the matching text that will be marked. Default to all parenthetical text.
marker
an HTMLgen class instance to which the found text will be sent for wrapping (using its __call__ method). Default is Emphasis.

Keywords

collapse
When set to 1 removes the non-grouped matching text from the output. Default 0.

Returns the number of matching text groups.

def prepend(self, *items)

Prepend one or more items to the top of the container.

SEE ALSO

HTMLgen

AbstractTag


Previous Next blank.gif blank.gif
Buzz.gif

Copyright © Robin Friedrich
All Rights Reserved
Comments to author: friedrich@pythonpros.com
Generated: Tue Apr 20, 1999