Velocity is often used for HTML templates, or other scenarios in which whitespace is generally insignificant. In some cases we can significantly reduce the size of the template output by trimming out whitespace in the template at parse time using the following rules:
Completely remove any sequence of (WHITESPACE | NEWLINE)+ at the beginning or end of a template.
Replace any sequence of (WHITESPACE | NEWLINE) NEWLINE (WHITESPACE | NEWLINE)* with a single newline
Replace any sequence of (WHITESPACE)+ with a single space
This should be made optional as there may be scenarios in which whitespace is significant and shouldn't be modified at all.
Velocity is often used for HTML templates, or other scenarios in which whitespace is generally insignificant. In some cases we can significantly reduce the size of the template output by trimming out whitespace in the template at parse time using the following rules:
(WHITESPACE | NEWLINE)+
at the beginning or end of a template.(WHITESPACE | NEWLINE) NEWLINE (WHITESPACE | NEWLINE)*
with a single newline(WHITESPACE)+
with a single spaceThis should be made optional as there may be scenarios in which whitespace is significant and shouldn't be modified at all.