compress

Syntax

[#compress]
body
[/#compress]

where:

Description

The compress directive is useful for removing superfluous whitespace when you use a whitespace insensitive format (e.g. HTML or XML).

It captures the output generated inside its body (i.e. between its start-tag and end-tag), and reduces all unbroken whitespace sequences to a single whitespace character. The inserted character will be a line break if the replaced sequence contains line breaks, or a space otherwise. The very first and very last unbroken whitespace sequences will be completely removed.

Examples

Here is a TGL code to compress:

[#set value = "    hello  \n\n   "]
([#compress]
1 2  3   4    5
${value}
test only

  I said, test only
[/#compress]) 

The compressed result will be:

(1 2 3 4 5
hello
test only
I said, test only)