0

I am using Socketstream default stack with Jade and ss-hogan for templating. I love it, except I can't figure out how to print a list. Example:

client.js

html = ss.tmpl['game-full'].render({
  name: 'GTA IV',
  platforms: [{
      name: 'ps3'
    }, {
      name: 'xbox'
    }
  ]
})

templates/game/full.jade

h1 {{name}} is fine
ul
  li I don't know how to list {{platforms}} here, one per li

I'm just a bit confused by the Jade>HTML>Hogan process I think, and not sure what syntax to use.

Simon Lang
  • 40,171
  • 9
  • 49
  • 58

1 Answers1

1

The way render an item in a list is documented here: https://gist.github.com/fat/1484342#file-gistfile1-html

An example in a SocketStream application can be found here: https://github.com/Anephenix/dashku/blob/master/client/templates/dashboard/nav.jade

Looking at your code, I would suggest trying this:

h1 {{name}} is fine
ul
  {{#platforms}}
  li I don't know how to list {{name}} here, one per li     
  {{/platforms}}
paulbjensen
  • 828
  • 7
  • 6