[Templates] Re: PROPOSAL: Add COMMENT BLOCK directive.
Paul Seamons
mail@seamons.com
Thu, 14 Jun 2007 09:26:01 -0600
> > Do you mean this to be something analogous to Javadoc? Otherwise there
> > is already a way to comment stuff with [%# %]. What do you mean by
> > "cross compatibility"?
I mean Template::Parser::CET will parse Template::Toolkit - OR Text::Tmpl - OR
HTML::Template::Expr - OR Velocity. That is what I mean by cross
compatibility. There needs to be a directive there to handle the comment.
> > [%#
> > Template section that won't be shown
> > [% var_a %]
> > [% IF foo %]Foo[% END %]
> > %]
>
> No, that won't do: The comment '[%#' ends with the *first* '%]' it
> encounters, there's no concept of nested tags (at least in TT2).
Exactly. That is why I mentioned the COMMENT directive from Text::Tmpl.
> So a comment block would add something I could have used sometimes in
> the past.
Thinking from a parser standpoint it would be easier and faster if we did
something like
[%#*
This is a block comment - notice the matching opening and closing comment
tags.
[% foo
*#%]
This is a little more similar to how the Velocity syntax does their block
comment. They actually use # for their tag delimeter so their block comment
is
#* comment goes here *#
Using the [%#* Way is easy to check for and would allow a fast parse to the
closing tag. It would also allow you to have broken TT inside the comment.
This is one failing of the COMMENT directive is that the TT inside still has
to be valid. A true block comment will allow for anything.
Paul