posthtml / posthtml-expressions

Use variables, JS-like expressions, and even markup-powered logic in your HTML.
Other
123 stars 20 forks source link

Loops #2

Closed jescalan closed 8 years ago

jescalan commented 8 years ago

So I know you have the each helper already, but I'm curious if there's anything built in here (or if there's another posthtml plugin that has it) to handle slightly more complex looping. For example:

locals: {
  people: [
    { name: 'Doge', location: 'New York' },
    { name: 'Cate', location: 'California' }
  ]
}

Let's say I want to loop over this data and produce something like this:

<ul>
  <li><strong>Doge</strong> lives in <strong>New York</strong></li>
  <li><strong>Cate</strong> lives in <strong>California</strong></li>
</ul>

Correct me if I'm wrong but there's no way to do this right now?

michael-ciniawsky commented 8 years ago

yes you're right, i'm working on a bigger update for the module, it has it's flaws and there needs to be a solution for block-level assignment, i'm trying to get a more generic approach where someone can 'register' there own helpers, but rarely find spare time at the moment.