Home » freemarker-2.3.13 » freemarker.template.utility » [javadoc | source]
freemarker.template.utility
public class: NormalizeNewlines [javadoc | source]
java.lang.Object
   freemarker.template.utility.NormalizeNewlines

All Implemented Interfaces:
    TemplateTransformModel

Transformer that supports FreeMarker legacy behavior: all newlines appearing within the transformed area will be transformed into the platform's default newline. Unlike the old behavior, however, newlines generated by the data model are also converted. Legacy behavior was to leave newlines in the data model unaltered.

Usage:
From java:

SimpleHash root = new SimpleHash();

root.put( "normalizeNewlines", new freemarker.template.utility.NormalizeNewlines() );

...

From your FreeMarker template:

<transform normalizeNewlines>
<html>
<head>
...
<p>This template has all newlines normalized to the current platform's
default.</p>
...
</body>
</html>
</transform>
Method from freemarker.template.utility.NormalizeNewlines Summary:
getWriter,   transform
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from freemarker.template.utility.NormalizeNewlines Detail:
 public Writer getWriter(Writer out,
    Map args) 
 public  void transform(Reader in,
    Writer out) throws IOException 
    Performs newline normalization on FreeMarker output.