Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I escape curly braces inside jade templates?

ho can I escape curly braces inside a jade teplate? (I use jade inside node.js)

I want to render jQuery templates to the client. The part I want to escape looks like this:

div(class='clear')
script(id='BoardListTemplate', type='text/x-jQuery-tmpl')
  <p>${Title}</p>
  <ul id="${Id}" class="IterationBoardList">
    <li class="AddNewItem">Add new Item</li>
    {{tmpl(Items) "#BoardListItemTemplate"}}
  </ul>
script(id='BoardListItemTemplate', type='text/x-jQuery-tmpl')
  <li class="Item" id="${{$data.Id}}">
    ${$data.Description}<br />
    Assigned to: ${$data.AssignedTo}<br/>
  StoryPoints: ${$data.StoryPoints}</li>
script(src='/javascripts/Scrummr.Engine.js', id='BoardListItemTemplate', type='text/javascript')

many thanks

like image 205
Juergen Gutsch Avatar asked Mar 15 '12 21:03

Juergen Gutsch


1 Answers

You have to use the pipe ( | ) sign in front of each line inside the script block.

See https://gist.github.com/2047079 for an example.

like image 158
Golo Roden Avatar answered Nov 02 '22 22:11

Golo Roden