Hallo Daniel,
thank you for you idea of "named body".

My use case:
Support you have a directive called <@layout_50_50/> and you have some other 
directives <@headline/>,
<@subheadline/> and so on. The <@layout_50_50> could do the following:

<@layout_50_50 left=[<@headline/>,<@subheadline/><@text/><@frame 
content=[<@headline/><@text/>]] right=[<@image>] />

Of course a layout_50_50 can also contain a layout_50_50 and so on.

Other notation:
<@page>
<@layout_50_50>
  <@left>
    <@headline/>
    <@subheadline/>
    <@text/>
    <@frame>
       <@headline text="hallo" />
       <@text content="lkjlkjkljl"/>
    </@frame> 
  <@right>
     <@image>
  </@right>
</@layout_50_50>
<@layout_30_30_30>
.....
</@layout_30_30_30>

</@page>

Yes, I think you are right, I am (We are) looking for something you call "named 
body".
So now I think "named body" is a better (more general) solution then "curry".

Yes, this would be a very nice and helpfull feature.


> Gesendet: Samstag, 13. Oktober 2018 um 22:10 Uhr
> Von: "Daniel Dekany" <[email protected]>
> An: "Ingo Mahnke" <[email protected]>
> Betreff: Re: Aw: Re:  Re: Directive as input for an other directive
>
> Saturday, October 13, 2018, 11:30:29 AM, Ingo Mahnke wrote:
> 
> >
> > Hallo Daniel,
> > thank you for your Information.
> >
> > This "curry" built-in makes sense to keep templates clean.
> 
> Though allowing `?curry(param=value)` syntax is a bit of a parser
> hack, because in a function call argument list `=` is equivalent with
> `==`, for historical reasons. It's still possible though, at least
> technically.
> 
> But, can you tell about your use case?
> 
> There's a long long dragged missing feature, often called "named
> bodies". It's like this, with an example:
> 
>   <@page>
>     <@header>
>       ...
>     </@header>
>     <@content someParam1=1 otherParam2=2>
>       ...
>     </@content>
>   </@page>
> 
> where the "header" and "content" macros don't do much themselves, they
> just define a section that then "page" will receive as a parameter.
> Not literarily as a parameter, but very similarly. Then the "page"
> macro can decide when to print the "header" and "content", and it can
> examine if they exist at all, and the parameters of them as well
> (someParam1 and someParam2). As such, it's somewhat similar to passing
> in macros as parameters to another macro. There are important
> differences though, like the execution of the nested content of
> "header" and "content" happens before "page" is invoked (similarly as
> the arguments are evaluated before a method it actually called in
> Java), only heir output is captured. I just wonder if this would cover
> your use case, or it's something very different.
> 
> >> Gesendet: Freitag, 12. Oktober 2018 um 22:31 Uhr
> >> Von: "Daniel Dekany" <[email protected]>
> >> An: "Ingo Mahnke" <[email protected]>
> >> Betreff: Re: Aw: Re: Directive as input for an other directive
> >>
> >> Friday, October 12, 2018, 9:26:58 PM, Ingo Mahnke wrote:
> >> 
> >> > Thank you Daniel!!!
> >> > This works. Freemarker is a powerfull system.
> >> >
> >> >
> >> > Now is it possible with "a" has a Parameter?
> >> > Something like this?
> >> >
> >> > <#macro a param1>
> >> > ${param1}
> >> > </#macro>
> >> >
> >> > <#macro b x>
> >> >  <@x/>
> >> > </#macro>
> >> >
> >> >
> >> > <@b x=(a param1="hallo world")/>
> >> 
> >> No, there's no construct for currying. So you had to define a macro
> >> with #macro that calls <@a param1="hallo world">, and then pass that
> >> macro as parameter, which is certainly too verbose for your purpose.
> >> 
> >> Actually, it's maybe not be that hard to add a built-in for
> >> currying... like a?curry(param1="hallo world").
> >> 
> >> > Thank you very much!
> >> >
> >> > Ingo
> >> >
> >> >
> >> >
> >> >> Gesendet: Freitag, 12. Oktober 2018 um 21:13 Uhr
> >> >> Von: "Daniel Dekany" <[email protected]>
> >> >> An: "Ingo Mahnke" <[email protected]>
> >> >> Betreff: Re: Directive as input for an other directive
> >> >>
> >> >> Friday, October 12, 2018, 5:46:19 PM, Ingo Mahnke wrote:
> >> >> 
> >> >> > Hallo!
> >> >> >
> >> >> >
> >> >> > <#macro a>
> >> >> > ...
> >> >> > </#macro>
> >> >> >
> >> >> > <#macro b x>
> >> >> > ${x}
> >> >> > </#macro>
> >> >> >
> >> >> > <@b x=a />
> >> >> >
> >> >> > Is this possible?
> >> >> 
> >> >> Yes, but since it's a directive, you can't print it with ${x},
> >> >> instead, you can call it like <@x/>.
> >> >> 
> >> >> > Thank you very very much.
> >> >> >
> >> >> > Ingo
> >> >> >
> >> >> 
> >> >> -- 
> >> >> Thanks,
> >> >>  Daniel Dekany
> >> >> 
> >> >> 
> >> >
> >> 
> >> -- 
> >> Thanks,
> >>  Daniel Dekany
> >> 
> >> 
> >
> 
> -- 
> Thanks,
>  Daniel Dekany
> 
> 

Reply via email to