Quantcast

Is it possible to assign multiple macro calls into an array

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is it possible to assign multiple macro calls into an array

Albert Kam
Hello !

I know this is absurd example, but instead of doing these repetitive row macro calls on each comment :
<@commentbox>
    <@row>
        <@comment id=1 />
    </@row>
    <@row>
        <@comment id=2 />
    </@row>
    <@row>
        <@comment id=1 />
    </@row>
</@commentbox>

It'll be simpler if i could do something like this :
<@commentbox>
  <#assign comments=[
        <@comment id=1 />, 
        <@comment id=2 />, 
        <@comment id=1 />
  ]>
  <@wrapInRow comments />
</@commentbox>

I know we can nest macro result within the assign tag, but it doesnt solve the repetitiveness of the assign tag calls.

Is this supported or planned ? Or perhaps there's a pattern for this situation ?

Thank you !

--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to assign multiple macro calls into an array

Daniel Dekany
Friday, February 13, 2015, 10:44:25 AM, Albert Kam wrote:

> Hello !
>
> I know this is absurd example, but instead of doing these
> repetitive row macro calls on each comment :
> <@commentbox>
>     <@row>
>         <@comment id=1 />
>     </@row>
>     <@row>
>         <@comment id=2 />
>     </@row>
>     <@row>
>         <@comment id=1 />
>     </@row>
> </@commentbox>
>
> It'll be simpler if i could do something like this :
> <@commentbox>
>   <#assign comments=[
>         <@comment id=1 />,
>         <@comment id=2 />,
>         <@comment id=1 />
>   ]>
>   <@wrapInRow comments />
> </@commentbox>
>
> I know we can nest macro result within the assign tag, but it
> doesnt solve the repetitiveness of the assign tag calls.
>
> Is this supported or planned ? Or perhaps there's a pattern for this situation ?

Not sure what input the @comment macros has in reality... it it were
only an ID-s, then this comes to my mind:

  <@wrapInRow comment 1 2 1 />

So here the trick is that you pass in the macro itself, and then the
argument for each macro call.

As of collecting macro calls in a list (actually, in a tree), then
calling them later... that's a tricky topic. Something similar is in
fact planned (mostly focusing on layout problems though), after some
other major developments, so it's very, very far away, given the pace
of development here.

> Thank you !

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to assign multiple macro calls into an array

Albert Kam
Ah, great idea. I could pass hashes as the arguments for more complex parameters.

Thanks !

On Sat, Feb 14, 2015 at 2:37 AM, Daniel Dekany <[hidden email]> wrote:
Friday, February 13, 2015, 10:44:25 AM, Albert Kam wrote:

> Hello !
>
> I know this is absurd example, but instead of doing these
> repetitive row macro calls on each comment :
> <@commentbox>
>     <@row>
>         <@comment id=1 />
>     </@row>
>     <@row>
>         <@comment id=2 />
>     </@row>
>     <@row>
>         <@comment id=1 />
>     </@row>
> </@commentbox>
>
> It'll be simpler if i could do something like this :
> <@commentbox>
>   <#assign comments=[
>         <@comment id=1 />,
>         <@comment id=2 />,
>         <@comment id=1 />
>   ]>
>   <@wrapInRow comments />
> </@commentbox>
>
> I know we can nest macro result within the assign tag, but it
> doesnt solve the repetitiveness of the assign tag calls.
>
> Is this supported or planned ? Or perhaps there's a pattern for this situation ?

Not sure what input the @comment macros has in reality... it it were
only an ID-s, then this comes to my mind:

  <@wrapInRow comment 1 2 1 />

So here the trick is that you pass in the macro itself, and then the
argument for each macro call.

As of collecting macro calls in a list (actually, in a tree), then
calling them later... that's a tricky topic. Something similar is in
fact planned (mostly focusing on layout problems though), after some
other major developments, so it's very, very far away, given the pace
of development here.

> Thank you !

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user



--
Do not pursue the past. Do not lose yourself in the future.
The past no longer is. The future has not yet come.
Looking deeply at life as it is in the very here and now,
the practitioner dwells in stability and freedom.
(Thich Nhat Hanh)

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user
Loading...