freemarker.template.utility
Class NormalizeNewlines

java.lang.Object
  |
  +--freemarker.template.utility.NormalizeNewlines
All Implemented Interfaces:
TemplateModel, TemplateTransformModel

public class NormalizeNewlines
extends java.lang.Object
implements TemplateTransformModel

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", 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>
 

Version:
$Id: NormalizeNewlines.java,v 1.4 2002/03/09 20:57:05 revusky Exp $

Constructor Summary
NormalizeNewlines()
          Creates new NormalizeNewlines
 
Method Summary
 boolean isEmpty()
           
 void transform(java.io.Reader source, java.io.Writer output)
          Performs newline normalization on FreeMarker output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NormalizeNewlines

public NormalizeNewlines()
Creates new NormalizeNewlines
Method Detail

transform

public void transform(java.io.Reader source,
                      java.io.Writer output)
               throws TemplateModelException,
                      java.io.IOException
Performs newline normalization on FreeMarker output.
Specified by:
transform in interface TemplateTransformModel
Parameters:
source - the input to be transformed
output - the destination of the transformation

isEmpty

public boolean isEmpty()
                throws TemplateModelException
Specified by:
isEmpty in interface TemplateModel
Returns:
true if this object is empty.