Saturday, January 7, 2017, 2:38:16 PM, Christoph Rüger wrote:
> regarding promoting freemarker:
> We are already doing that in our Cloud-Data-platform where you can
> use freemarker to do almost anything to transform, map and manipulate data.
> We use it for our own application too (all templates) but we also
> have chosen Freemarker as the main internal scripting language for data
> transformation.
>
> Here is a small example which just concatenates two variables in
> the column "newtitle". Check it out if you want. It goes in a
> similar direction as http://freemarker-online.kenshoo.com/
>
> That being said I think we are also happy to contribute interesting
> usecases, examples and whatever which could be spread using
> SocialMedia. We have lots of examples in our own documentation
> (here)
I would only answer to this as technical guy.
Your use cases are interesting in that you want not-so-technical
people to write templates. For example, apparently, you have hard time
dealing with null-s in your application (lot of `exp!`-s everywhere),
so you may want to chime in when the null/missing handling
improvements in FM3 are discussed.
BTW I see some examples like ${datecalc("HOUR", 1)!?datetime}. I guess
you can't possibly get a null there. Even if you do, ?datetime will be
unhappy with the '' it had to convert to date-time, unless you have a
custom data-time format there.
> (it"s german...just use google translator) where we show how to do
> various stuff with Freemarker expressions. We have also written some
> own functions (here) which could also be useful maybe as core
> built-ins (see here)
Some questions/notes...
How does `escapeHTML(exp)` differ from `exp?html`?
What's the practical use of `unescapeHTML(exp)`?
Also note that there's the auto-escaping machinery (output formats,
?esc, etc.) nowadays. It tries to removing the responsibility of
escaping from the template author (without using #escape, which itself
can be forgotten, or had to be added with TemplateLoader hacks). You
can have HTML fragments in the data-model that are automatically *not*
escaped, and everything else is automatically escaped. But even if
your data-model can't be made that smart (i.e. HTML is also Space), at
least you escape be default (and the you can do exp?noEsc to prevent
it), which is safer than the opposite.
As of `now()`, we have `.now`, though that returns a java.util.Date
instead of a long. So the equivalent is `.now?long`, which is somewhat
ugly. Note sure why and how often do you need the numerical version
though.
> Just let me know if this is interesting, so we can think about
> concrete stuff we could contribute where it fits.
Calendar arithmetic is something users often request (i.e., adding a
day, truncating the date down to the beginning of the month/day/hour
and such). Anyway, if you have some concrete recommendation for
built-ins, tell us.
I'm interested to hear what your major pain points with FM are. A
single template engine can't be ideal for everyone, but I'm hoping to
cover more kind of usages in FM 3. (Or even in FM2, though I think
things will be worked out in FM 3 and then maybe ported back where
possible and if we have the resources).
> I don't want this to be considered spam - so let me know what you
> think... but of course it would be promotion for us too
>
> Christoph
>
>
>
>
>
> 2017-01-07 13:36 GMT+01:00 Daniel Dekany <[email protected]>:
> Saturday, January 7, 2017, 9:37:36 AM, Denis Bredelet wrote:
>
>> Hi Daniel,
>>
>>>> That was also my impression on the OFBiz tweet, as a software
>>>> developer. The last is important, that I'm looking at it as a
>>>> developer. FreeMarker, unless OFBiz, is mostly only interesting for
>>>> them I believe. It doesn't have an UI that a manager type could click
>>>> around. It's not a complete end-user product, it's Java library used
>>>> internally by other products.
>>
>> I am thinking of contributing a very simple UI for FreeMarker.
>> Something able to read a single template and process it with a
>> datamodel pulled from various sources (user interface window, properties
>> file, XML file…)
>>
>> Would that be useful and help with advertising FreeMarker?
>
> I believe it's something that many users need, because it's not always
> convenient to try things right in the real product that integrates
> FreeMarker. Especially if you just want the wrap your head around
> something you have just read in the Manual. So I was considering
> creating a such GUI, only my priorities (core maintenance) didn't
> allow that. And then suddenly come
> http://freemarker-online.kenshoo.com/, so we do have something like
> that, but it could be improved further, also perhaps an offline
> version (like a SWT application or such) can be handy (if you want to
> connect to a local DB, etc).
>
> These template evaluators are also useful to draw the user's attention
> to best practices and features. Like if you go to
> http://freemarker-online.kenshoo.com/, you will be aware of output
> formats, a relatively novel but very useful feature.
>
>> I have some code to use as a starting point on my website:
>> http://bredelet.com/Denis/FreeMarker%20first%20steps.html
>
> These are some getting started examples. What are your ideas about the
> final product?
>
>> Maybe this could come as a separate JAR to avoid loading UI classes
>> unnecessarily.
>
>> Cheers,
>> — Denis.
>
> --
> Thanks,
> Daniel Dekany
--
Thanks,
Daniel Dekany