|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.ext.misc.NormalizeNewlines
public final class NormalizeNewlines
Transformer that supports FreeMarker legacy behaviour: all newlines appearing within the transformed area will be transformed into the platform's default newline. Unlike the old behaviour, however, newlines generated by the data model are also converted. Legacy behaviour was to leave newlines in the data model unaltered.
Usage:
From java:
TemplateModelRoot root = new SimpleHash(); root.put( "normalizeNewlines", freemarker.ext.misc.NormalizeNewlines.getInstance() ); ...
From your FM-Classic template:
<transform normalizeNewlines> <html> <head> ... <p>This template has all newlines normalized to the current platform's default.</p> ... </body> </html> </transform>
Note:
NormalizeNewlines
is a singleton instance. Use the
getInstance()
method to retrieve instances of this model.
CompressLines
,
Serialized FormMethod Summary | |
---|---|
static NormalizeNewlines |
getInstance()
Retrieve a singleton instance of this class. |
boolean |
isEmpty()
Is the object empty? |
void |
transform(java.io.Reader source,
java.io.PrintWriter output)
Performs newline normalization on FM-Classic output. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static NormalizeNewlines getInstance()
NormalizeNewlines
classpublic void transform(java.io.Reader source, java.io.PrintWriter output) throws TemplateModelException
transform
in interface TemplateTransformModel
source
- the input to be transformedoutput
- the destination of the transformation
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 |