Hi Daniel and Jacques, The Freemarker source is for human beings, and the results for a browser. So I would like IDE support for completion and indenting for Freemarker source.
The results don't matter so much, and if there is an option to pretty-print the results, I would argue that pretty-printing should be optional, and pretty-printing should be off by default to save processor cycles. It's just the sort of thing you might want to turn on in a debugging situation, and off in production. XML processors seem to do a similar thing. If you want human-readable output, you ask for it. See for example http://docs.oracle.com/javase/tutorial/jaxp/xslt/writingDom.html , where call setOutputProperty when you want the output indented. Cheers Paul Foxworthy Jacques Le Roux wrote > Hi Daniel, > > From: "Daniel Dekany" < > ddekany@ > > >> Wednesday, February 27, 2013, 12:07:00 PM, Jacques Le Roux wrote: >> >>> Hi Daniel, >>> >>> When I think about Freemarker, it's just the perfect tool to me >>> when it comes to generate conditional HTML code (I mostly use it in >>> this context). I never missed anything but a tool to format the code. >>> There are some Freemarker Eclipse plugins around, but none of them >>> is able to format the code. >> >> Surely improving IDE plugins is at least as important as improving >> FreeMarker itself... or if someone just have basic templates (no fancy >> macro libraries and such), it's actually much more important. I won't >> be able to work on IDE plugins in this cycle though. >> >>> And anyway there are more to this than >>> IDE usage. For instance, templates can be used in the context of a CMS. >>> >>> So what I would really enjoy would be : >>> 1) A consensus on how to format the code, where 2 spaces would be >>> used for indentation spacing. >> >> (You should use the same indentation size for FTL tags as for the >> generated code. Like, in Java templates you use 4, but in HTML >> templates 2.) >> >>> Some proposed to format the FTL code >>> independently of the generated code (HTML in my, and motstly OFBiz >>> OOTB, case). I would prefer to indent both at the same time but to >>> also generate the (HTML) code formatted independently of the >>> freemarker file content. I can give an example if necessary... >> >> Do you mean things like: >> >> foo >> <#if ...> >> bar >> </#if> >> baaz >> >> should output >> >> foo >> bar >> baaz >> >> instead of >> >> foo >> bar >> baaz >> >> ? Then I think that should be done by FreeMarker itself when it loads >> the templates. (Although this becomes lot more tricky if you consider >> macro calls... then it has to be done partially on runtime.) > > Yes that's exactly what I meant, > 1) A tool to automatically format as below. IDE plugin comes to mind, but > of course an independent tool, reused by IDE plugins, would be better. >> foo >> <#if ...> >> bar >> </#if> >> baaz > by taking into account only the Freemarker syntax, (HTML)content following > Freemarker indentation > > 2) Freemarker renderers to format HTML or XML code (more could be used) as > expected by the convention used for this language depending on tags (as > you said indentation of 2 spaces for HTML, IMO same for XML). > >>> 2) This would be an independent tool (class or package, maybe a >>> lib) usable in many circumstances, IDE plugins being the one coming >>> instantly to mind >> >> I plan (just a plan...) to write an FTL 2.3->2.4 (or -> 3.0?) >> conversion tool, because I want to deprecate or even ban some >> historical FTL baggage when FreeMarker is not used in >> 2.3.0-compatible-mode (no worries, 2.3.0-compatible will be the >> default). Maybe it will be a good place to add re-indentation logic to >> later. > > Sure, it's just an idea for a long term plan. Actually IDE plugins should > have their own Freemarker formatters. But it seems nobody care, and I > really wonder why. Notably JBoss, they have much more resources than any > of us... > > BTW I use Eclipse, is IntelliJ IDEA doing better? Just read that > http://stackoverflow.com/questions/9385561/freemarker-eclipse-plug-in#comments-9395144 > > Jacques > >>> Thanks for asking >>> >>> Jacques >>> >>> >>> From: "Daniel Dekany" < > ddekany@ > > >>>> Monday, February 25, 2013, 5:51:24 PM, Jacopo Cappellato wrote: >>>> >>>>> Hi Daniel, >>>>> >>>>> thanks for contacting us and for your efforts in improving Freemarker. >>>>> Freemarker is indeed important for OFBiz because it is the primary >>>>> template engine and we have several screens implemented with it. >>>>> >>>>> One of the tickets I would love to see resolved is this: >>>>> >>>>> https://sourceforge.net/tracker/index.php?func=detail&aid=3527625&group_id=794&atid=100794 >>>> >>>> Sure, that's #2 on the 2.3.20 TODO list, and 2.3.20 comes before >>>> whatever other more ambitious developments. >>>> >>>> Here, I mostly wanted to hear about any FreeMarker related "itches". >>>> Like annoyances that you have to go through again and again, or some >>>> features you wish it had. >>>> >>>> -- >>>> Thanks, >>>> Daniel Dekany >>>> >>>>> In fact we are currently using in OFBiz a modified version of >>>>> Freemarker jar to integrate this feature. >>>>> >>>>> I will try to keep an eye on the Freemarker forums and activities >>>>> and I will try to offer my help if I see areas where I could help; >>>>> of course feel free to contact us for help on specific tasks too, we >>>>> will do our best to support your efforts. >>>>> >>>>> Kind regards, >>>>> >>>>> Jacopo >>>>> >>>>> On Feb 23, 2013, at 12:37 PM, Daniel Dekany wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> I'm the main maintainer of the FreeMarker template engine over the >>>>>> last few years. I plan to allocate serious amount of time[*] for >>>>>> FreeMarker development in the near future, at least if I perceive >>>>>> that >>>>>> there's enough interest in the developer community (of OfBiz, Struts, >>>>>> Alfresco, Magnolia, etc). The goal of this effort is fixing >>>>>> long-standing issues (mostly design issues that can be addressed >>>>>> without breaking backward compatibility), adding frequently requested >>>>>> missing features, increasing usability (better error messages, better >>>>>> documentation) and to make FreeMarker more accessible for potential >>>>>> contributors (fixing the branching mess, switching to Maven, Git, >>>>>> modularization, addressing licensing and CLA issues). >>>>>> >>>>>> Thus, I would like to hear about the wishes of the OFBiz developers. >>>>>> What features you crave for the most, how could FreeMarker integrate >>>>>> better with your product, what are the things your users most often >>>>>> has problems with, etc. >>>>>> >>>>>> *: I'm thinking about 300 hours or so, done within a 2-3 months >>>>>> period, but it depends on the feedback. This I plan to do for free. >>>>>> If FreeMarker is an important component in your ecosystem, and you >>>>>> think you can support this effort in some ways, of course, contact >>>>>> me. >>>>>> >>>>>> -- >>>>>> Thanks, >>>>>> Daniel Dekany >> >> -- >> Thanks, >> Daniel Dekany >> ----- -- Coherent Software Australia Pty Ltd http://www.coherentsoftware.com.au/ Bonsai ERP, the all-inclusive ERP system http://www.bonsaierp.com.au/ -- View this message in context: http://ofbiz.135035.n4.nabble.com/Survey-for-preparing-FreeMarker-development-effort-tp4639549p4639808.html Sent from the OFBiz - Dev mailing list archive at Nabble.com.