Whitespace control
A template is laid out for people, with line breaks and indentation, and PAD keeps that layout in what it writes. Usually that does not matter - HTML folds whitespace - but in plain-text mail, CSV, JSON, console output and inline layouts it does.
The ~ marker
A ~ just inside a brace takes the whitespace on that side of it, newlines included:
-
{~tag}- the whitespace before the tag -
{tag~}- the whitespace after it, which for an opening tag is the start of its content -
{~/tag~}- both sides of the closing tag
Only a brace that opens a tag counts: a ~ in text, in CSS or in a quoted parameter stays as it is.
|
PHP |
HTML fragments/whitespace_1.pad |
Result |
|---|---|---|
|
abc onetwo |
spaceless
{spaceless} takes the whitespace between HTML tags out of everything it wraps, and at both ends; text inside a tag keeps its spaces. For the whole page there is {tidy}.