Miscellaneous Arcana

The Template Toolkit is full of other convenient features, but most Slash templates use only the few functions described here. There’s no reason to limit yourself, though, if you can make your site more powerful or easier to maintain. If you go on to write your own templates, there are a few extra things you should know.

Whitespace

By default, Slash templates preserve whitespace between directives. That is, two output-producing blocks, separated by a blank line or a space, will have the same whitespace character between their output. For example:

Katie has written [% num %] comment
	[% IF num > 1; 's'; END %]
.

given num of 2 will produce:

Katie has written 2 comment
s
.

Get Running Weblogs with Slash now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.