Re: Escaping in VTL (was Re: Velocity JSP Generation)
agreed. this is not my preferred escaping system either, but we can't just go changing it now. i can't think of any way to make such a change backwards compatible. the best that could be done (if someone is interested in doing it) in 1.x, would be to make escaping behavior configurable via a simple property toggle, but even then, the current behavior would have to stay the default option. On Fri, 25 Feb 2005 11:17:36 -0800, Will Glass-Husain <[EMAIL PROTECTED]> wrote: > Yes. It's confusing. But I'd vote against changing this (for the 1.x > series) or all > my app-generating templates will break. > > WILL > > - Original Message - > From: "Gonzalo Diethelm" <[EMAIL PROTECTED]> > To: "'Velocity Users List'" > Sent: Friday, February 25, 2005 7:09 AM > Subject: RE: Escaping in VTL (was Re: Velocity JSP Generation) > > >> Doesn't quite work that easily. > >> > >> The problem is that if "#directive" is not an actual macro, > >> than \#directive > >> is shown verbatim. You only should escape when the same > >> code is legit in > >> both the source and the generated Velocity. This can be a > >> little confusing. > > > > I know there is no agreement on this. To me, this behavior breaks the > > principle of least astonishment. > > > > http://en.wikipedia.org/wiki/Principle_of_least_astonishment > > > > Regards, > > > > > > -- > > Gonzalo Diethelm > > [EMAIL PROTECTED] > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Escaping in VTL (was Re: Velocity JSP Generation)
Yes. It's confusing. But I'd vote against changing this (for the 1.x series) or all my app-generating templates will break. WILL - Original Message - From: "Gonzalo Diethelm" <[EMAIL PROTECTED]> To: "'Velocity Users List'" Sent: Friday, February 25, 2005 7:09 AM Subject: RE: Escaping in VTL (was Re: Velocity JSP Generation) Doesn't quite work that easily. The problem is that if "#directive" is not an actual macro, than \#directive is shown verbatim. You only should escape when the same code is legit in both the source and the generated Velocity. This can be a little confusing. I know there is no agreement on this. To me, this behavior breaks the principle of least astonishment. http://en.wikipedia.org/wiki/Principle_of_least_astonishment Regards, -- Gonzalo Diethelm [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Escaping in VTL (was Re: Velocity JSP Generation)
> Doesn't quite work that easily. > > The problem is that if "#directive" is not an actual macro, > than \#directive > is shown verbatim. You only should escape when the same > code is legit in > both the source and the generated Velocity. This can be a > little confusing. I know there is no agreement on this. To me, this behavior breaks the principle of least astonishment. http://en.wikipedia.org/wiki/Principle_of_least_astonishment Regards, -- Gonzalo Diethelm [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Escaping in VTL (was Re: Velocity JSP Generation)
Will Glass-Husain <[EMAIL PROTECTED]> wrote: > Doesn't quite work that easily. > > The problem is that if "#directive" is not an actual macro, than \#directive > is shown verbatim. You only should escape when the same code is legit in > both the source and the generated Velocity. This can be a little confusing. Now, see, that's exactly the kind of garbage I avoid. I see now I left off another "rule" that I follow. - Always perform escaping with variable replace (preferrably EscapeTool). Ie, ${esc.hash} or ${poundSign} and not \# -Mike > - Original Message - > From: "Mike Kienenberger" <[EMAIL PROTECTED]> > To: "Shinobu Kawai" <[EMAIL PROTECTED]>; "Velocity Users List" > > Cc: "Velocity Users List" > Sent: Thursday, February 24, 2005 7:07 PM > Subject: Re: Escaping in VTL (was Re: Velocity JSP Generation) > > > > Shinobu Kawai <[EMAIL PROTECTED]> wrote: > >> > Escaping the VTL properly was a little challenging, but otherwise it > >> > was > > no > >> > big deal. > >> > >> I still don't "get" the whole escaping scheme, partly because I can't > >> find any documentation that is completely correct. We might want a > >> document totally devoted to escaping in VTL. :( > > > > Escape all [$], [#], ["], [!] and [']. (actually, ! might be overkill, > > but > > better safe than sorry.) Just use your tool :) > > > > Always use formal notation ${x} > > > > That's always worked for me, and never surprises me. > > > > -Mike > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Escaping in VTL (was Re: Velocity JSP Generation)
Doesn't quite work that easily. The problem is that if "#directive" is not an actual macro, than \#directive is shown verbatim. You only should escape when the same code is legit in both the source and the generated Velocity. This can be a little confusing. Will - Original Message - From: "Mike Kienenberger" <[EMAIL PROTECTED]> To: "Shinobu Kawai" <[EMAIL PROTECTED]>; "Velocity Users List" Cc: "Velocity Users List" Sent: Thursday, February 24, 2005 7:07 PM Subject: Re: Escaping in VTL (was Re: Velocity JSP Generation) Shinobu Kawai <[EMAIL PROTECTED]> wrote: > Escaping the VTL properly was a little challenging, but otherwise it > was no > big deal. I still don't "get" the whole escaping scheme, partly because I can't find any documentation that is completely correct. We might want a document totally devoted to escaping in VTL. :( Escape all [$], [#], ["], [!] and [']. (actually, ! might be overkill, but better safe than sorry.) Just use your tool :) Always use formal notation ${x} That's always worked for me, and never surprises me. -Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Escaping in VTL (was Re: Velocity JSP Generation)
Hi Mike, > > I still don't "get" the whole escaping scheme, partly because I can't > > find any documentation that is completely correct. We might want a > > document totally devoted to escaping in VTL. :( > > Escape all [$], [#], ["], [!] and [']. (actually, ! might be overkill, but > better safe than sorry.) Just use your tool :) I'll add [\] to that. :) > Always use formal notation ${x} > > That's always worked for me, and never surprises me. If I can be sure that EscapeTool will be in the Context, it isn't hard at all. But what if it's not? Anyways, what I wanted to say was "I want a complete and accurate document on how escaping works in Velocity." It should cover references, directives, silent notation, formal notation, schmoo... Anything else? Best regards, -- Shinobu -- Shinobu Kawai <[EMAIL PROTECTED]> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Escaping in VTL (was Re: Velocity JSP Generation)
Shinobu Kawai <[EMAIL PROTECTED]> wrote: > > Escaping the VTL properly was a little challenging, but otherwise it was no > > big deal. > > I still don't "get" the whole escaping scheme, partly because I can't > find any documentation that is completely correct. We might want a > document totally devoted to escaping in VTL. :( Escape all [$], [#], ["], [!] and [']. (actually, ! might be overkill, but better safe than sorry.) Just use your tool :) Always use formal notation ${x} That's always worked for me, and never surprises me. -Mike - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Escaping in VTL (was Re: Velocity JSP Generation)
Hi Will, > > #* > > First time I've ever heard of "creating JSP with Velocity". :) > > I wonder if anybody uses Velocity to create Velocity templates. I > > might need to add vtl to the EscapeTool. (half joking, half...) > > *# > > Ha. I wrote an app that uses Velocity to generate Velocity templates. It's > a "quick start" tool to generate a Velocity-based application for new users. Wow! Great work. :-) > Escaping the VTL properly was a little challenging, but otherwise it was no > big deal. I still don't "get" the whole escaping scheme, partly because I can't find any documentation that is completely correct. We might want a document totally devoted to escaping in VTL. :( Best regards, -- Shinobu -- Shinobu Kawai <[EMAIL PROTECTED]> - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]