freemarker.template.utility
Class CompressWhitespace
java.lang.Object
|
+--freemarker.template.utility.CompressWhitespace
- All Implemented Interfaces:
- TemplateModel, TemplateTransformModel
- public class CompressWhitespace
- extends java.lang.Object
- implements TemplateTransformModel
A transform model that compresses each occurrence of consecutive whitespace
down to a single space character. Leading and trailing whitespace is also
removed.
Usage:
From java:
TemplateModelRoot root = new SimpleHash();
root.put( "compressWhitespace", new freemarker.template.utility.CompressWhitespace() );
...
From your FreeMarker template:
The following is executed:
<transform compressWhitespace>
<p>This paragraph has all whitespace reduced to a single
space character.</p>
</transform>
...
- Version:
- $Id: CompressWhitespace.java,v 1.3 2001/06/12 10:11:24 run2000 Exp $
- See Also:
LegacyCompress
|
Method Summary |
boolean |
isEmpty()
|
void |
transform(java.io.Reader source,
java.io.PrintWriter output)
Compresses whitespace within the marked portion of a FreeMarker template. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CompressWhitespace
public CompressWhitespace()
- Creates new CompressWhitespace
transform
public void transform(java.io.Reader source,
java.io.PrintWriter output)
throws TemplateModelException
- Compresses whitespace within the marked portion of a FreeMarker template.
- Specified by:
transform in interface TemplateTransformModel
- Parameters:
source - the input to be transformedoutput - the destination of the transformation
isEmpty
public boolean isEmpty()
throws TemplateModelException
- Specified by:
isEmpty in interface TemplateModel
- Returns:
- true if this object is empty.