|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.ext.misc.CompressWhitespace
public final class CompressWhitespace
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", freemarker.ext.misc.CompressWhitespace.getInstance() ); ...
From your FM-Classic template:
The following is compressed: <transform compressWhitespace> <p>This paragraph has all whitespace reduced to a single space character.</p> </transform> ...
Note:
CompressWhitespace
is a singleton instance. Use the
getInstance()
method to retrieve instances of this model.
LegacyCompress
,
CompressLines
,
Serialized FormMethod Summary | |
---|---|
static CompressWhitespace |
getInstance()
Retrieve a singleton instance of this class. |
boolean |
isEmpty()
Is the object empty? |
void |
transform(java.io.Reader source,
java.io.Writer 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 |
Method Detail |
---|
public static CompressWhitespace getInstance()
CompressWhitespace
classpublic void transform(java.io.Reader source, java.io.Writer output) throws java.io.IOException, TemplateModelException
transform
in interface TemplateTransformModel2
source
- the input to be transformedoutput
- the destination of the transformation
java.io.IOException
TemplateModelException
public boolean isEmpty() throws TemplateModelException
isEmpty
in interface TemplateModel
false
, to indicate this object is not empty
TemplateModelException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |