5.8 Directive Syntax Rules

Directive tags begin with a hash character (#) and are used for comments, loops, conditional blocks, includes, and all other advanced features. Cheetah uses a Python-like syntax inside directive tags and understands any valid Python expression. However, unlike Python, Cheetah does not use colons (:) and indentation to mark off multi-line directives. That doesn't work in an environment where whitespace is significant as part of the text. Instead, multi-line directives like #for have corresponding closing tags (#end for). Most directives are direct mirrors of Python statements.

Many directives have arguments after the opening tag, which must be in the specified syntax for the tag. All end tags have the following syntax:

#end TAG_NAME [EXPR]
The expression is ignored, so it's essentially a comment.



Subsections