Page 1 of 1

Comments in Template Editor

PostPosted: Fri Sep 02, 2011 6:52 am
by eobermuhlner
Is it possible to have comments in the template editor?

I want to comment the template without the comment being visible in the generated code.
Of course, using the comment syntax of the underlying language (in my case Java) also works - but the comment is visible in the generated code which might confuse the other developers.

Re: Comments in Template Editor

PostPosted: Fri Sep 02, 2011 1:24 pm
by micha
No, it is currently not possible to insert comments which only comment the template and are not inserted in the generated code.

As a workaround, the easiest way would be to create a function which always returns false. Then, create a context which calls this function in the selector and insert your comments there. You may want to use a different comment style to distinguish between generated comments of your target language and template comments.

Re: Comments in Template Editor

PostPosted: Fri Sep 02, 2011 2:55 pm
by eobermuhlner
That is exactly the workaround that we discussed here.

We created a function:
Code: Select all
templateComment(Resource)

Since practically everything is a Resource we can reference the function from any context in the selector.

Also useful to disable entire blocks in the template that are not yet working.