Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between [% %] and [%- -%] in Template Toolkit?

What is the difference between [% %] and [%- -%] in Template Toolkit?

like image 736
Gaurav Rathi Avatar asked Mar 23 '15 06:03

Gaurav Rathi


People also ask

What is the Template Toolkit?

The Template Toolkit is an all-Perl template processing system. Unlike many other Perl templating systems, it is as proficient at producing HTML as it is at producing XML, PDF, or any other output format. It has its own simple templating language, so templates can be written and edited by people who do not know Perl.

What is the difference between a template and a framework?

With functions, pre-defined modules and libraries to use, anyone can easily use the framework to create a basic web application. The usage depends on your requirements. On the other hand, templates are more like reusable boxes that can be used with less tweak (or no tweak at all).

When should I make changes to the Template Toolkit?

If you want to add functionality to the Template Toolkit or have found a bug that you can fix, and you want your patch to be accepted by Template Toolkit developers, you should make your changes against the current CVS HEAD.

What is the difference between ttree and the Template Toolkit?

The first major difference is that ttree works with entire directories of templates rather than with single files. If you’re using the Template Toolkit to build a web site, for example, you can point ttree at a directory of source templates to process them all, saving the generated HTML pages to corresponding files in an output directory.


1 Answers

The - automatically removes some whitespace from before/after the directive tag.

See Template::Manual::Syntax:

You can add - or + to the immediate start or end of a directive tag to control the whitespace chomping options. See the PRE_CHOMP and POST_CHOMP options for further details.

See Template::Manual::Config for good examples of the effects with and without pre and post chomping.

like image 92
ysth Avatar answered Oct 24 '22 07:10

ysth