t, lt, rt
Page Contents
Synopsis
<#t> <#lt> <#rt>
Description
These directives, instruct FreeMarker to ignore certain white-space in the line of the tag:
-
t (for trim): Ignore all leading and trailing white-space in this line.
-
lt (for left trim): Ignore all leading white-space in this line.
-
rt (for right trim): Ignore all trailing white-space in this line.
where:
-
``leading white-space'' means all space and tab (and other character that are white-space according to UNICODE, except line breaks) before the first non-white-space character of the line.
-
``trailing white-space'' means all space and tab (and other character that are white-space according to UNICODE, except line breaks) after the last non-white-space character of the line, and the line break at the end of the line.
It is important to understand that these directives examine the template itself, and not the output what the template generates when you merge it with the data-model. (That is, the white-space removal happens on parse time.)
For example this:
| |||
will output this:
| |||
The placement of these directives inside the line has no importance. That is, the effect will be the same regardless if you put the directive at the beginning of the line, or at the end of the line, or in the middle of the line.