Previous Next blank.gif blank.gif

Class DefinitionList - Show a series of items and item definitions.


SYNOPSIS

import HTMLgen
class DefinitionList(List)
  string __module__ = 'HTMLgen'
  tuple attrs = ('class', 'id', 'style')
  tuple flags = ('compact',)
  def render_list_item(self, item)
  string tagname = 'DL'

  # Methods inherited by DefinitionList from List
  def __getslice__(self, i, j)
  def __init__(self, list = None, **kw)
  def __str__(self)
  def append(self, *items)
  def column_slices(self, columns=1)
  def end_element(self)
  def multi_column_table(self)
  def start_element(self)
  def sub_list(self, list)

  # Methods inherited by DefinitionList from UserList
  def __add__(self, list)
  def __cmp__(self, list)
  def __delitem__(self, i)
  def __delslice__(self, i, j)
  def __getitem__(self, i)
  def __len__(self)
  def __mul__(self, n)
  def __mul__(self, n)
  def __radd__(self, list)
  def __repr__(self)
  def __setitem__(self, i, item)
  def __setslice__(self, i, j, list)
  def count(self, item)
  def index(self, item)
  def insert(self, i, item)
  def pop(self, i=-1)
  def remove(self, item)
  def reverse(self)
  def sort(self, *args)
alias DL = DefinitionList

DESCRIPTION

Arg is a list of tuple pairs: "(string/object,string/object),(,)..." 1st item in each pair is the word to be defined. It will be rendered in bold. 2nd is the string which will be indented to it's next-line-right. If the compact flag is set to non-empty, the definition side will be placed on the same line. Example

DefinitionList([( 4 , 'Number after 3') , ( 1 , 'Unity')] ) will emit: 4 Number after 3 1 Unity

def append(self, *items)

Append entries to the end of the list

def column_slices(self, columns=1)

Calculate a list of index pairs bounding column slices.

def end_element(self)

Closes the HTML element

def multi_column_table(self)

Return a table containing the list sliced into columns.

def render_list_item(self, item)

Overload method to perform DT/DD markup.

def start_element(self)

Generic creator for the HTML element opening tag.

Reads tagname, attrs and flags to return appropriate tag.

def sub_list(self, list)

Recursive method for generating a subordinate list

SEE ALSO

HTMLgen

List


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