Handlebars
模板
{{#each persons as | person |}}
    {{name}} lives in {{#with (lookup ../cities [resident-in])~}}
      {{name}} ({{country}})
    {{/with}}
{{/each}}
准备脚本
// Handlebars.registerHelper('loud', function(string) {
//    return string.toUpperCase()
// });
输入
{
  persons: [
    {
      name: "Nils",
      "resident-in": "darmstadt",
    },
    {
      name: "Yehuda",
      "resident-in": "san-francisco",
    },
  ],
  cities: {
    darmstadt: {
      name: "Darmstadt",
      country: "Germany",
    },
    "san-francisco": {
      name: "San Francisco",
      country: "USA",
    },
  },
}
输出
    Nils lives in Darmstadt (Germany)
    Yehuda lives in San Francisco (USA)
最后更新: 2019 年 11 月 2 日,上午 8:12:45