tmpvar / weld

Template antimatter for Node.js (Browsers too!)
673 stars 39 forks source link

Is it possible to weld nested arrays? #38

Closed dsego closed 13 years ago

dsego commented 13 years ago

I would like to have a nested structure which repeats containers (e.g. months) and nests other items inside (e.g. activities). I've been playing with the code but haven't figured out how to do this. Is this possible. Is this a valid case or is there perhaps a better way to achieve the same result?

[{'month' : 'May', 'activities' : [{'name' : 'A'}] },
 {'month' : 'June', 'activities' : [{'name' : 'B'}, {'name' : 'C'}] },
 {'month' : 'July', 'activities' : [{'name' : 'D'}, {'name' : 'E'}] }]
<div class="month">
  <div class="name">Dummy Activity 1</div>
  <div class="name">Dummy Activity 2</div>
  <div class="name">Dummy Activity 3</div>
</div>
<div class="month">
  <div class="name">Dummy Activity 4</div>
</div>
dsego commented 13 years ago

I think I found the solution to this. Maybe you could add it as an example.

  <div class="month">   
  <div class="activities">
  <div class="name">Dummy Activity</div>
  </div>
</div>