You are trying to solve the wrong problem. Don’t pass numbered variables to the 
template, in fact don’t ever use numbered variables. Use a list instead.


> On 01 Jan 2015, at 17:42, Matt Anonyme <[email protected]> wrote:
> 
> I've got a similar problem, I would like to display the variable of a 
> variable. I have in the context the variables "ws0°,"ws1", "ws2", etc... I 
> would like the following code to print the actual values of the variuables 
> ws0, ws1, ws2 instead of just printing "ws0", "ws1", "ws2". Similar to an 
> eval function.
> 
> {%- for ws_id in range(1, 10) %}
> {{ "ws%d" | format(ws_id) )  }}
> {%- endfor %}
> 
> Any tip plz ?
> 
> 
> Le mardi 10 décembre 2013 01:38:58 UTC+1, Matt Chaput a écrit :
> I'm trying to use Jinja to walk through a JSON tree and render each "node" in 
> the tree using different macros based on the information in the node.
> 
> Is there a way to call a macro "by name" in a template? That is, in a 
> template, can I take a string, use it to look up the macro by that name, and 
> then call the macro?
> 
> Even if it requires writing an extension, I don't mind writing one, but I 
> can't figure out from the limited extension documentation how I would do it 
> that way either.
> 
> Thanks,
> 
> Matt
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "pocoo-libs" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/pocoo-libs 
> <http://groups.google.com/group/pocoo-libs>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pocoo-libs.
For more options, visit https://groups.google.com/d/optout.

Reply via email to