Re: Is it possible to assign multiple macro calls into an array
Daniel Dekany <[email protected]> Fri, 13 Feb 2015 20:37:47 +0100
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
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/