premasagar / tim

A tiny, secure JavaScript micro-templating script.
251 stars 26 forks source link

How to render an array of strings? #20

Closed ismasan closed 8 years ago

ismasan commented 8 years ago

Hello. First of all thank you so much for this library.

My question: it is not clear to me how to render an array of strings, example:

tim("{{tags}}<li>{{ ? }}</li>{{/tags}}", {tags: ["tag1", "tag2", "tag3"]})

Any advice welcome. I'll be happy to document this in a pull request.

Regards.

aron commented 8 years ago

From looking at the readme.

tim("{{tags}}<li>{{_content}}</li>{{/tags}}", {tags: ["tag1", "tag2", "tag3"]})

It's not very clear though...

ismasan commented 8 years ago

Ah, I didn't realise that works too, since it's documented as "iterating over objects". Thanks.