freemarker.template.utility
Class StandardCompress
java.lang.Object
freemarker.template.utility.StandardCompress
- TemplateModel, TemplateTransformModel
public class StandardCompress
extends java.lang.Object
A filter that compresses each sequence of consecutive whitespace
to a single line break (if the sequence contains a line break) or a
single space. In addition, leading and trailing whitespace is
completely removed.
Specify the transform parameter
single_line = true
to always compress to a single space instead of a line break.
The default buffer size can be overridden by specifying a
buffer_size
transform parameter (in bytes).
Note: The compress tag is implemented using this filter
Usage:
From java:
SimpleHash root = new SimpleHash();
root.put( "standardCompress", new freemarker.template.utility.StandardCompress() );
...
From your FreeMarker template:
<transform standardCompress>
<p>This paragraph will have
extraneous
whitespace removed.</p>
</transform>
Output:
<p>This paragraph will have
extraneous
whitespace removed.</p>
$Id: StandardCompress.java,v 1.14 2004/01/06 17:06:43 szegedia Exp $
StandardCompress
public StandardCompress()
StandardCompress
public StandardCompress(int defaultBufferSize)
defaultBufferSize
- the default amount of characters to buffer