Support generating inline partial blocks in a list
Child template
{>base_template/}
{#loop}
{<"var_{$idx}"}
{/"var_{$idx}"}
{/loop}
Base template
{#anotherloop}
{+"var_{$idx}"}
{#anotherloop}
for instance looping a list of items and each iteration of the item in a child template creates a different inline partial block ,
so this means a array.list of inline partial blocks can be created as we iterated.
Once created, we can reference the indexed inline partial block in the base template
is this good?
What follows on from this defining of a number of inline params in terms of the use cases you are imagining?
@rragan updated the description to be more precise.
So this is a way to turn an array of things into a series of variable values that can be accessed by index? E.g not a true array anymore,
Ignoring the technical difficulty with dynamic inline partials (since the compiler binds them at build time but you want to resolve them at run time), I still don't see the value -- assuming the technical issues can be overcome? It seems like if we want variable and array storage dynamically created at runtime, then we should explore that. Of course, that is another step towards making dust a programming language rather than a templating language.
is n't this simply extending dynamic partials concept. ? If partials can be invoked dynamically , why not inline partials. Not sure if this is possible with current implementation, since @jairodemorais did try and succeed partially.
@jairodemoraishttps://github.com/jairodemorais and I had a long chat and didn’t find a way around the technical issues given the current handling of inline partials at compile time and how to make them dynamic at runtime. Dynamic partials are resolved at runtime, but inline partials are processed at compile time in the current implementation making them pretty different even though they look similar on the surface of things.
From: Veena Basavaraj [mailto:[email protected]] Sent: Tuesday, September 04, 2012 10:35 AM To: linkedin/dustjs Cc: Ragan, Richard Subject: Re: [dustjs] Support the inline partial blocks as well to be dynamic (#77)
is n't this simply extending dynamic partials concept. ? If partials can be invoked dynamically , why not inline partials. Not sure if this is possible with current implementation, since @jairodemoraishttps://github.com/jairodemorais did try and succeed partially.
— Reply to this email directly or view it on GitHubhttps://github.com/linkedin/dustjs/issues/77#issuecomment-8271787.
@vybs
@rragan is right! the only way is resolving the key at runtime, I have developed a first approach you can take a look here:
https://github.com/jairodemorais/dustjs/tree/DynamicInline