Package lemon :: Package external :: Package Cheetah :: Module Filters :: Class Strip
[show private | hide private]
[frames | no frames]

Class Strip

Filter --+
         |
        Strip


Strip leading/trailing whitespace but preserve newlines.

    This filter goes through the value line by line, removing leading and
    trailing whitespace on each line.  It does not strip newlines, so every
    input line corresponds to one output line, with its trailing newline intact.

    We do not use val.split('
') because that would squeeze out consecutive
    blank lines.  Instead, we search for each newline individually.  This
    makes us unable to use the fast C .split method, but it makes the filter
    much more widely useful.

    This filter is intended to be usable both with the #filter directive and
    with the proposed #sed directive (which has not been ratified yet.)

Method Summary
  filter(self, val, **kw)
Replace None with an empty string.
    Inherited from Filter
  __init__(self, templateObj)
Setup a ref to the templateObj.
  generateAutoArgs(self)
This hook allows the filters to generate an arg-list that will be appended to the arg-list of a $placeholder tag when it is being translated into Python code during the template compilation process.

Method Details

filter(self, val, **kw)

Replace None with an empty string.  Reimplement this method if you
want more advanced filterting.
Overrides:
lemon.external.Cheetah.Filters.Filter.filter (inherited documentation)

Generated by Epydoc 2.0 on Mon Nov 10 15:08:33 2003 http://epydoc.sf.net