You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Geir Magnusson Jr." <ge...@optonline.net> on 2000/11/30 06:15:55 UTC

proposal : special conditional treatment of <% and %>

This idea has been tossed around, maybe even by the WM crowd.  Doesn't
matter where it came from, it's a good one.

My interest is motivated by a client's interest in building a site using
Velocity, but wants inexperienced design staff to use Dreamweaver to
create the pages / templates.

So, with that in mind, to better support the acceptance of Velocity, and
aid in its displacement of commercial solutions, I want to add to
Velocity the feature that if a property is set, such as 

  misc.norender.scripttags = true (default false)

then '<%' and '%>' will not be rendered to the output.  Otherwise, they
are rendered as any other piece of schmoo.

Why?

This will allow Velocity users to use GUI/WYSIWYG HTML editors that put
<% and %> around script/code elements for ASP, JSP et al without having
the <% and %> render to the output.  It means both that when you open a
Velocity template in one of those tools,  the VTL won't interfere with
the WYSIWYG rendering of the page, and you can use the tool's method to
add script/code to a page.  Now, I personally like seeing the
script/code/VTL, but each to his/her own, I guess.

I think this is pretty simple, so I won't belabor the point.  Again, if
you don't explcitly turn this feature on, nothing will be different, so
it won't ever interfere with other Velocity uses.

Please, if anyone has any problems with this, lets hash it out sooner
rather than later.  Given no real dissention, I hope to have this done
tomorrow night or friday so my client can use it next time I visit them,
on monday.

geir


-- 
Geir Magnusson Jr.                               geirm@optonline.com
Dakota tribal wisdom: "when you discover you are riding a dead horse,
the best strategy is to dismount."

Re: proposal : special conditional treatment of <% and %>

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Geir Magnusson Jr." <ge...@optonline.net> writes:

> jvanzyl@periapt.com wrote:
> > I was thinking about the idea of an input filter that could
> > be specified with a template loader. I wanted to implement
> > an input filter for so that WM template stream could be
> > transformed into a Velocity stream and then parsed.
> 
> LOL. :D
>  
> > Could we do the same with the <% %>, have an input filter
> > for stripping the <% %> out of the stream and then passing
> > it on to the parser, then the parser structure doesn't
> > have to be altered at all.
> 
> Yep.  Good!  I like this much better.

So do I, +1!

Dan

Re: proposal : special conditional treatment of <% and %>

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
jvanzyl@periapt.com wrote:
> 
> On Thu, 30 Nov 2000, Geir Magnusson Jr. wrote:
> 
> > Daniel Rall wrote:
> > >
> > > "Geir Magnusson Jr." <ge...@optonline.net> writes:
> > >
> > >
> > > +1 on the condition that this behavior defaults to turned off.  I'm
> > > not really in favor of this "feature", but it will surely help in the
> > > spread of Velocity as a server-side markup.
> >
> > Yes, the intent was of course to keep them turned off by default.
> 
> I was thinking about the idea of an input filter that could
> be specified with a template loader. I wanted to implement
> an input filter for so that WM template stream could be
> transformed into a Velocity stream and then parsed.

LOL. :D
 
> Could we do the same with the <% %>, have an input filter
> for stripping the <% %> out of the stream and then passing
> it on to the parser, then the parser structure doesn't
> have to be altered at all.

Yep.  Good!  I like this much better.

geir



-- 
Geir Magnusson Jr.                               geirm@optonline.com
Dakota tribal wisdom: "when you discover you are riding a dead horse,
the best strategy is to dismount."

Re: proposal : special conditional treatment of <% and %>

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Christoph Reck wrote:
> 
> +1 mee too for the template input filter approach for this.
> 
> How will this be configured?
> * One filter for all template paths?
> * One fore each template path?
> * Having a filter chain (probably an overkill)?
> I guess for 99.9% of the purposes, the first one is sufficient.
> Therefore the filter attached to the template loader should
> be defined as an interface to allow future upgrades.

I had a couple of thoughts on this yesterday. 

- Yes, I think they should be chainable. 
- I think they should be 'installable' from both properties files as
well as 'invokable' or 'insertable' at runtime for the specific template
by the app using vel.
- I think we should have both general filters, that apply to all
template streams coming into the engine, and all merge() streams going
out.
- I think they should be specifically attachable to a specific loader /
path as well.
- It would also be the right way, I think, of doing things like HTML
compression and such.

I will hack something for my client this weekend for the tag problem and
not commit it as I think this is a powerful and cool feature, and should
be implemented right. :)

geir

> :) Christoph
> 
> jvanzyl@periapt.com wrote:
> >
> > On Thu, 30 Nov 2000, Geir Magnusson Jr. wrote:
> >
> > > Daniel Rall wrote:
> > > >
> > > > "Geir Magnusson Jr." <ge...@optonline.net> writes:
> > > >
> > > >
> > > > +1 on the condition that this behavior defaults to turned off.  I'm
> > > > not really in favor of this "feature", but it will surely help in the
> > > > spread of Velocity as a server-side markup.
> > >
> > > Yes, the intent was of course to keep them turned off by default.
> >
> > I was thinking about the idea of an input filter that could
> > be specified with a template loader. I wanted to implement
> > an input filter for so that WM template stream could be
> > transformed into a Velocity stream and then parsed.
> >
> > Could we do the same with the <% %>, have an input filter
> > for stripping the <% %> out of the stream and then passing
> > it on to the parser, then the parser structure doesn't
> > have to be altered at all.
> >
> > jvz.

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Dakota tribal wisdom: "when you discover you are riding a dead horse,
the best strategy is to dismount."

Re: proposal : special conditional treatment of <% and %>

Posted by Christoph Reck <Ch...@dlr.de>.
+1 mee too for the template input filter approach for this.

How will this be configured? 
* One filter for all template paths? 
* One fore each template path?
* Having a filter chain (probably an overkill)?
I guess for 99.9% of the purposes, the first one is sufficient.
Therefore the filter attached to the template loader should
be defined as an interface to allow future upgrades.

:) Christoph

jvanzyl@periapt.com wrote:
> 
> On Thu, 30 Nov 2000, Geir Magnusson Jr. wrote:
> 
> > Daniel Rall wrote:
> > >
> > > "Geir Magnusson Jr." <ge...@optonline.net> writes:
> > >
> > >
> > > +1 on the condition that this behavior defaults to turned off.  I'm
> > > not really in favor of this "feature", but it will surely help in the
> > > spread of Velocity as a server-side markup.
> >
> > Yes, the intent was of course to keep them turned off by default.
> 
> I was thinking about the idea of an input filter that could
> be specified with a template loader. I wanted to implement
> an input filter for so that WM template stream could be
> transformed into a Velocity stream and then parsed.
> 
> Could we do the same with the <% %>, have an input filter
> for stripping the <% %> out of the stream and then passing
> it on to the parser, then the parser structure doesn't
> have to be altered at all.
> 
> jvz.

Re: proposal : special conditional treatment of <% and %>

Posted by jv...@periapt.com.

On Thu, 30 Nov 2000, Geir Magnusson Jr. wrote:

> Daniel Rall wrote:
> > 
> > "Geir Magnusson Jr." <ge...@optonline.net> writes:
> >
> > 
> > +1 on the condition that this behavior defaults to turned off.  I'm
> > not really in favor of this "feature", but it will surely help in the
> > spread of Velocity as a server-side markup.
> 
> Yes, the intent was of course to keep them turned off by default.

I was thinking about the idea of an input filter that could
be specified with a template loader. I wanted to implement
an input filter for so that WM template stream could be
transformed into a Velocity stream and then parsed.

Could we do the same with the <% %>, have an input filter
for stripping the <% %> out of the stream and then passing
it on to the parser, then the parser structure doesn't
have to be altered at all.

jvz.


Re: proposal : special conditional treatment of <% and %>

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Daniel Rall wrote:
> 
> "Geir Magnusson Jr." <ge...@optonline.net> writes:
>
> 
> +1 on the condition that this behavior defaults to turned off.  I'm
> not really in favor of this "feature", but it will surely help in the
> spread of Velocity as a server-side markup.

Yes, the intent was of course to keep them turned off by default.

geir

-- 
Geir Magnusson Jr.                               geirm@optonline.com
Dakota tribal wisdom: "when you discover you are riding a dead horse,
the best strategy is to dismount."

Re: proposal : special conditional treatment of <% and %>

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Geir Magnusson Jr." <ge...@optonline.net> writes:

> This idea has been tossed around, maybe even by the WM crowd.  Doesn't
> matter where it came from, it's a good one.
> 
> My interest is motivated by a client's interest in building a site using
> Velocity, but wants inexperienced design staff to use Dreamweaver to
> create the pages / templates.
> 
> So, with that in mind, to better support the acceptance of Velocity, and
> aid in its displacement of commercial solutions, I want to add to
> Velocity the feature that if a property is set, such as 
> 
>   misc.norender.scripttags = true (default false)
> 
> then '<%' and '%>' will not be rendered to the output.  Otherwise, they
> are rendered as any other piece of schmoo.

+1 on the condition that this behavior defaults to turned off.  I'm
not really in favor of this "feature", but it will surely help in the
spread of Velocity as a server-side markup.

Daniel

Re: proposal : special conditional treatment of <% and %>

Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Geir Magnusson Jr." <ge...@optonline.net> writes:

> This idea has been tossed around, maybe even by the WM crowd.  Doesn't
> matter where it came from, it's a good one.
> 
> My interest is motivated by a client's interest in building a site using
> Velocity, but wants inexperienced design staff to use Dreamweaver to
> create the pages / templates.
> 
> So, with that in mind, to better support the acceptance of Velocity, and
> aid in its displacement of commercial solutions, I want to add to
> Velocity the feature that if a property is set, such as 
> 
>   misc.norender.scripttags = true (default false)
> 
> then '<%' and '%>' will not be rendered to the output.  Otherwise, they
> are rendered as any other piece of schmoo.

+1 on the condition that this behavior defaults to turned off.  I'm
not really in favor of this "feature", but it will surely help in the
spread of Velocity as a server-side markup.

Daniel