Package docutils :: Module statemachine :: Class StringList
[show private | hide private]
[frames | no frames]

Class StringList

ViewList --+
           |
          StringList


A ViewList with string-specific methods.
Method Summary
  get_indented(self, start, until_blank, strip_indent, block_indent, first_indent)
Extract and return a StringList of indented lines of text.
  get_text_block(self, start, flush_left)
Return a contiguous block of text.
  strip_indent(self, length, start, end)
Strip length characters off the beginning of each item, in-place, from index start to end.
    Inherited from ViewList
  __init__(self, initlist, source, items, parent, parent_offset)
  __add__(self, other)
  __cmp__(self, other)
  __contains__(self, item)
  __delitem__(self, i)
  __eq__(self, other)
  __ge__(self, other)
  __getitem__(self, i)
  __gt__(self, other)
  __iadd__(self, other)
  __imul__(self, n)
  __le__(self, other)
  __len__(self)
  __lt__(self, other)
  __mul__(self, n)
  __ne__(self, other)
  __radd__(self, other)
  __repr__(self)
  __rmul__(self, n)
  __setitem__(self, i, item)
  __str__(self)
  append(self, item, source, offset)
  count(self, item)
  disconnect(self)
Break link between this list and parent list.
  extend(self, other)
  index(self, item)
  info(self, i)
Return source & offset for index i.
  insert(self, i, item, source, offset)
  offset(self, i)
Return offset for index i.
  pop(self, i)
  remove(self, item)
  reverse(self)
  sort(self, *args)
  source(self, i)
Return source for index i.
  trim_end(self, n)
Remove items from the end of the list, without touching the parent.
  trim_start(self, n)
Remove items from the start of the list, without touching the parent.

Method Details

get_indented(self, start=0, until_blank=0, strip_indent=1, block_indent=None, first_indent=None)

Extract and return a StringList of indented lines of text.

Collect all lines with indentation, determine the minimum indentation, remove the minimum indentation from all indented lines (unless strip_indent is false), and return them. All lines up to but not including the first unindented line will be returned.

Parameters:
start - The index of the first line to examine.
until_blank - Stop collecting at the first blank line if true.
strip_indent - Strip common leading indent if true (default).
block_indent - The indent of the entire block, if known.
first_indent - The indent of the first line, if known.
Returns:
  • a StringList of indented lines with mininum indent removed;
  • the amount of the indent;
  • a boolean: did the indented block finish with a blank line or EOF?

get_text_block(self, start, flush_left=0)

Return a contiguous block of text.

If flush_left is true, raise UnexpectedIndentationError if an indented line is encountered before the text block ends (with a blank line).

strip_indent(self, length, start=0, end=2147483647)

Strip length characters off the beginning of each item, in-place, from index start to end. No whitespace-checking is done on the stripped text. Does not affect slice parent.

Generated by Epydoc 2.0 on Tue Jul 22 05:31:44 2003 http://epydoc.sf.net