Mustache and Haml

会有一股神秘感。 提交于 2019-11-30 09:54:46

I'm not sure about rendering with Sinatra, but with this command:

cat example.yml foo.haml.mustache | mustache | haml -e

this data file example.yml

---
data:
  - items:
    - item:
      - id: 1
      - id: 2
      - id: 3
---    

and template (foo.haml.mustache ):

{{#data}}
#ok
{{#items}}
{{#item}}
  %b ID: {{id}}
{{/item}}
{{/items}}
{{/data}}

I get following result:

<div id='ok'>
  <b>ID: 1</b>
  <b>ID: 2</b>
  <b>ID: 3</b>
</div>

Pls pay attention to indentation level in *.mustache file. Hope this help you.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!