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. |