You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Alexander Dubinin <ad...@gmail.com> on 2008/01/06 14:36:53 UTC

Re: How to disable some directives in Velocity Engine? How to avoid conflict of VTL comment and comments in shell script templates?

Hi Nathan,


> You could just use something like:
>
> #set( $H = '#' )
> $H$H this is a shell comment
> ## this is a VTL comment
>
It was first that came to mind...
But usually users just using "copy-paste" - and don't bother with such things :)
Only alternative, I see now - use preprocessor and isolate blocks with VTL.

Does Velocity have some kind of "directive processor" like in other
template engines?
For example, "String Templates" or MS VS template engine?

I've tried to dig into code... So much hard-coded things, that it
remembered me programming classes 20 years ago - then we started to
learn C :)

Anyway, thanks for idea :)

On Dec 31, 2007 8:54 PM, Nathan Bubna <nb...@gmail.com> wrote:
> On Dec 26, 2007 11:40 AM, Alexander Dubinin <ad...@gmail.com> wrote:
> > Hi all,
> >
> > I'm looking for effective template engine for processing templates in
> > my program.
> > It should process templates, stored in database, and generate plain
> > text output stream.
> > It may be shell scripts, configuration files, XML files, etc. - just a
> > random plain text, generated from set of templates.
> >
> > Currently I ave 2 problems with Velocity:
> > 1. Due to security reasons (all processing is done in memory at WEB
> > server with DB, and users are able to modify templates), need to have
> > a way to disable some directives. At least, the ones which working
> > with template files - #parse and #include.
> > 2. For shell script templates, need to distinguish between VTL
> > comments and shell comments. It's common situation, then multiple "#"
> > characters are used in shell scripts to identify script sections...
> > It would be great to allow usage of custom character for directives
> > (Or, at least, for VTL comments), instead of "#" - for specific
> > template only.
>
> That would be nice, but no one has ever stepped up to provide such flexibility.
>
> > Does anybody have ideas, how to solve these problems?
> >
> > Thanks in advance,
> >
> > --
> > Regards,
> >   Alexander Dubinin

-- 
Regards,
  Alexander Dubinin

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org