Re: Scope of variable for <#nested> while using #import

2017-11-22 Thread Swapnil Mane
Thank you Daniel for sharing your thoughts on this, it looks good to me.


- Best Regards,
Swapnil M Mane




On Wed, Nov 22, 2017 at 12:40 PM, Daniel Dekany <ddek...@apache.org> wrote:

> Wednesday, November 22, 2017, 7:14:34 AM, Swapnil Mane wrote:
>
> > Dear Daniel,
> >
> > Thank you so much for your kind inputs.
> > Passing back values in nested works for me.
> >
> > Please see my comments inline.
> >
> > On Sat, Nov 18, 2017 at 12:50 AM, Daniel Dekany <ddek...@apache.org>
> wrote:
> >
> >> Friday, November 17, 2017, 3:55:22 PM, Daniel Dekany wrote:
> >>
> >> > #assign sets the variable in the current namespace. Each #include-d
> >>
> >> I wanted to write #import"-ed above... #include-d templates use the
> >> namespace of the includer.
> >>
> >> > template has its own namespace, plus the the topmost template has its
> >> > own namespace (the "main" namespace). So if you use #assign like that,
> >> > then in the other namespace you had to write ${widget.name}. You
> might
> >> > want to use #global instead, and then the variable is visible from
> >> > everywhere (unless it's shadowed by a variable of the same name in the
> >> > same namespace). (It's also possible to pass back a value like
> >> > <#nested "FreeMarker World"> and then
> >> > <@widget.getName ; name>${name}. Also you should
> write
> >> > a #function if you just want to get a value, not a macro, as that has
> >> > a return value.)
> >>
> >
> > My bad, I used wrong example here (*getName*), actually I want multiple
> > values for #nested code.
> > like
> >
> > Defining macro
> > <#macro linkInfo>
> >   <#local name = "FreeMarker World"/>
> >   <#local url = "https://freemarker.apache.org/"/>
> >   <#nested name, url>
> > 
> >
> > Using the defined macro
> >
> > <#import
> > "component://hwmapps/template/commerce/templates/Widgets.ftl" as
> e/>>
> > <@e.linkInfo ; name, url>
> >   ${name!}
> > 
> >
> >
> > So, in my case, I think, macro is needed instead of function.
>
> Another possibility is returning (or pass via #nested) a single hash
> value, like { "name": "Foo", "url": "http://foo.bar; }, and then,
> assuming that r is the returned value, you can use r.name and r.url.
>
>
> >> > See also: https://freemarker.apache.org/docs/dgui_misc_namespace.html
> >> >
> >> >
> >> > Friday, November 17, 2017, 1:56:03 PM, Swapnil Mane wrote:
> >> >
> >> >> Dear FreeMarker team,
> >> >>
> >> >> First I would like to thank you for creating such a nice template
> >> engine, I
> >> >> personally liked it very much :-)
> >> >>
> >> >> I need your help in an issue,
> >> >>
> >> >> While using <#nested>, the variable I defined using assign is not
> >> >> accessible in nested code.
> >> >>
> >> >> Here is the more details
> >> >>
> >> >> 1.) I have a macro file having Widgets.ftl
> >> >>
> >> >> {code}
> >> >>
> >> >> <#macro getName>
> >> >> <#assign name = "FreeMarker World"/>
> >> >> <#nested>
> >> >> 
> >> >>
> >> >> {code}
> >> >>
> >> >> 2.) I have included the above file in another file using <#import>
> >> >>
> >> >> {code}
> >> >>
> >> >> <#import "Widgets.ftl" as widget>
> >> >> <@widget.getName>
> >> >> Hi ${name!}
> >> >> 
> >> >>
> >> >> {code}
> >> >>
> >> >> Expected output - Hi FreeMarker World
> >> >> Actual output - Hi
> >> >>
> >> >>
> >> >> Here the value of 'name' variable is not setting properly if assign
> is
> >> used.
> >> >> But when I set it using global, everything work as expected.
> >> >>
> >> >> {code}
> >> >> <#global name = "FreeMarker World"/>
> >> >> {code}
> >> >>
> >> >> The similar types of macros will be heavily used in my application
> and
> >> >> setting it at global level will cause performance and memory issue.
> So,
> >> I
> >> >> want to set value of variable using assign.
> >> >>
> >> >> Please let me know if I am missing anything.
> >> >> Thanks again for your time and contribution.
> >> >>
> >> >> - Best Regards,
> >> >> Swapnil M Mane
> >> >
> >>
> >> --
> >> Thanks,
> >>  Daniel Dekany
> >>
> >>
> > Thanks again for sharing your time.
> > P.S. Apologies for late reply, I was out of town :-)
> >
> > - Best Regards,
> > Swapnil M Mane
>
> --
> Thanks,
>  Daniel Dekany
>
>


Re: Scope of variable for <#nested> while using #import

2017-11-21 Thread Swapnil Mane
Dear Daniel,

Thank you so much for your kind inputs.
Passing back values in nested works for me.

Please see my comments inline.

On Sat, Nov 18, 2017 at 12:50 AM, Daniel Dekany <ddek...@apache.org> wrote:

> Friday, November 17, 2017, 3:55:22 PM, Daniel Dekany wrote:
>
> > #assign sets the variable in the current namespace. Each #include-d
>
> I wanted to write #import"-ed above... #include-d templates use the
> namespace of the includer.
>
> > template has its own namespace, plus the the topmost template has its
> > own namespace (the "main" namespace). So if you use #assign like that,
> > then in the other namespace you had to write ${widget.name}. You might
> > want to use #global instead, and then the variable is visible from
> > everywhere (unless it's shadowed by a variable of the same name in the
> > same namespace). (It's also possible to pass back a value like
> > <#nested "FreeMarker World"> and then
> > <@widget.getName ; name>${name}. Also you should write
> > a #function if you just want to get a value, not a macro, as that has
> > a return value.)
>

My bad, I used wrong example here (*getName*), actually I want multiple
values for #nested code.
like

Defining macro
<#macro linkInfo>
  <#local name = "FreeMarker World"/>
  <#local url = "https://freemarker.apache.org/"/>
  <#nested name, url>


Using the defined macro

<#import "component://hwmapps/template/commerce/templates/Widgets.ftl" as
e/>
<@e.linkInfo ; name, url>
  ${name!}



So, in my case, I think, macro is needed instead of function.


>
> > See also: https://freemarker.apache.org/docs/dgui_misc_namespace.html
> >
> >
> > Friday, November 17, 2017, 1:56:03 PM, Swapnil Mane wrote:
> >
> >> Dear FreeMarker team,
> >>
> >> First I would like to thank you for creating such a nice template
> engine, I
> >> personally liked it very much :-)
> >>
> >> I need your help in an issue,
> >>
> >> While using <#nested>, the variable I defined using assign is not
> >> accessible in nested code.
> >>
> >> Here is the more details
> >>
> >> 1.) I have a macro file having Widgets.ftl
> >>
> >> {code}
> >>
> >> <#macro getName>
> >> <#assign name = "FreeMarker World"/>
> >> <#nested>
> >> 
> >>
> >> {code}
> >>
> >> 2.) I have included the above file in another file using <#import>
> >>
> >> {code}
> >>
> >> <#import "Widgets.ftl" as widget>
> >> <@widget.getName>
> >> Hi ${name!}
> >> 
> >>
> >> {code}
> >>
> >> Expected output - Hi FreeMarker World
> >> Actual output - Hi
> >>
> >>
> >> Here the value of 'name' variable is not setting properly if assign is
> used.
> >> But when I set it using global, everything work as expected.
> >>
> >> {code}
> >> <#global name = "FreeMarker World"/>
> >> {code}
> >>
> >> The similar types of macros will be heavily used in my application and
> >> setting it at global level will cause performance and memory issue. So,
> I
> >> want to set value of variable using assign.
> >>
> >> Please let me know if I am missing anything.
> >> Thanks again for your time and contribution.
> >>
> >> - Best Regards,
> >> Swapnil M Mane
> >
>
> --
> Thanks,
>  Daniel Dekany
>
>
Thanks again for sharing your time.
P.S. Apologies for late reply, I was out of town :-)

- Best Regards,
Swapnil M Mane


Scope of variable for <#nested> while using #import

2017-11-17 Thread Swapnil Mane
Dear FreeMarker team,

First I would like to thank you for creating such a nice template engine, I
personally liked it very much :-)

I need your help in an issue,

While using <#nested>, the variable I defined using assign is not
accessible in nested code.

Here is the more details

1.) I have a macro file having Widgets.ftl

{code}

<#macro getName>
<#assign name = "FreeMarker World"/>
<#nested>


{code}

2.) I have included the above file in another file using <#import>

{code}

<#import "Widgets.ftl" as widget>
<@widget.getName>
Hi ${name!}


{code}

Expected output - Hi FreeMarker World
Actual output - Hi


Here the value of 'name' variable is not setting properly if assign is used.
But when I set it using global, everything work as expected.

{code}
<#global name = "FreeMarker World"/>
{code}

The similar types of macros will be heavily used in my application and
setting it at global level will cause performance and memory issue. So, I
want to set value of variable using assign.

Please let me know if I am missing anything.
Thanks again for your time and contribution.

- Best Regards,
Swapnil M Mane


Re: Started graduation resolution DISCUSS on general@incubator.a.o

2018-02-22 Thread Swapnil Mane
Congratulations team!!


- Best Regards,
Swapnil M Mane

On Thu, Feb 22, 2018 at 6:40 PM, Jacopo Cappellato <
jacopo.cappell...@gmail.com> wrote:

> The vote is now closed and it was successful!
> While this is not the final step in the graduation process, and we will
> have to wait until the 21st of March for the ASF Board to ratify the
> resolution to establish the project, it is indeed an important step and
> achievement: we got 12 positive binding votes from Incubator PMC members
> and no negative votes. Congratulations to the community!
>
> I am going to wait for a few days before submitting the resolution to the
> next Board meeting agenda.
>
> Kind regards,
>
> Jacopo
>
>
> On Tue, Feb 6, 2018 at 6:42 PM, Daniel Dekany  wrote:
>
> > I have started the resolution DISCUSS thread on the
> > general@incubator.a.o. PPMC members please follow the discussion, and
> > chime in if necessary!
> >
> > --
> > Thanks,
> >  Daniel Dekany
> >
> >
>