Re: Any plans for a 100% wm syntax compatibility?
Jonathan Revusky <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Demetrios Kyriakis wrote: > Hi, > > are there any plans to support 100% "wm" (well I mean Velocity :) ) syntax? > I mean 100% in the template files (maybe with some switch property in the > config of FM)? > > I think this would ease greatly the move to FM: it would pose no risks for > the users since they would have no conversion work, so trying FM would mean > just chaning a JAR (for most cases). > > Thank you, > > Demetrios. > We have a conversion utility that works pretty well for just changing the syntax. Actually, the most recent version of it (which should be up on our website but isn't) can be got via svn. svn co https://freemarker.svn.sourceforge.net/svnroot/freemarker/tools/vel2ftl You can run ant at the top level of the checkout and it will build you an executable jar file that converts .vm to .ftl syntax. As Daniel pointed out, you do have the problem that the semantics differ, but this still gets you a lot of the way there. Of course, Velocity syntax could be supported, I guess, by reading in the .vm template file and using the above code to convert it to .ftl and then reading it in. You could write a custom TemplateLoader that does this for the .vm extension, I suppose. That would support Velocity syntax, but with FreeMarker semantics, on nulls or missing values and how macro parameters are passed and so on. And that is not much incremental work. The problem is in the difference in semantics, and also, that some of freemarker's most appealing features would not be available, since you can't express them using Velocity syntax. JR ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/