One of the first decisions we encountered was which delimiter syntax to use.
We decided to follow Velocity's $placeholder
and #directive
syntax because the former is widely used in other languages for the same
purpose, and the latter stands out in an HTML or text document. We also
implemented the ${longPlaceholder}
syntax like the shells for cases
where Cheetah or you might be confused where a placeholder ends. Tavis went
ahead and made $(longPlaceholder}
and $[longPlaceholder]
interchangeable with it since it was trivial to implement. Finally,
the #compiler
directive allows you to change the delimiters if you
don't like them or if they conflict with the text in your document.
(Obviously, if your document contains a Perl program listing, you don't
necessarily want to backslash each and every $
and #
, do you?)
The choice of comment delimiters was more arbitrary. ##
and
#* ...*#
doesn't match any language, but it's reminiscent of
Python and C while also being consistent with our ``#
is for
directives'' convention.
We specifically chose not to use pseudo HTML tags for placeholders and directives, as described more thoroughly in the Cheetah Users' Guide introduction. Pseudo HTML tags may be easier to see in a visual editor (supposedly), but in text editors they're hard to distinguish from ``real'' HTML tags unless you look closely, and they're many more keystrokes to type. Also, if you make a mistake, the tag will show up as literal text in the rendered HTML page where it will be easy to notice and eradicate, rather than disappearing as bogus HTML tags do in browsers.