Couchdb问题中的胡须部分

Couchdb问题中的胡须部分,couchdb,mustache,Couchdb,Mustache,我是运行couchdb 1.0.1的couchdb新手 我有一个非常基本的问题。我无法在列表中呈现胡子部分。 下面是我的列表,其中包含一个示例中硬编码的数据 function(head, req) { start({ "headers": { "Content-Type": "text/html" } }); var mustache = require("lib/mustache"); var view = {name:

我是运行couchdb 1.0.1的couchdb新手

我有一个非常基本的问题。我无法在列表中呈现胡子部分。 下面是我的列表,其中包含一个示例中硬编码的数据

function(head, req) {
    start({
        "headers": {
            "Content-Type": "text/html"
        }
    });
var mustache = require("lib/mustache");
var view = {name: "Joe's shopping card",items: ["bananas", "apples"]};
var template = "{{name}}: <ul> {{#items}}<li>{{.}}</li>{{/items}} </ul>";
return mustache.to_html(template,view);
功能(头部,需求){
开始({
“标题”:{
“内容类型”:“文本/html”
}
});
var mustache=require(“lib/mustache”);
var view={name:“乔的购物卡”,项目:[“香蕉”,“苹果”]};
var template=“{name}}:
    {{{items}}
  • {{.}
  • {{items}
”; 返回mustache.to_html(模板、视图);
产出:

Joe's shopping card: <ul> <li></li><li></li></ul>
乔的购物卡:
    • 请帮忙

      谢谢,,
      /杰夫

      噢,巴夫,我刚想出来,这有点不可思议。这是给任何想节省时间的人的。把它添加到你的模板“{{%IMPLICIT-ITERATOR}”

      因此:

      var-template=“{{name}:
        {{{{items}}
      • {{.}
      • {{/items}
      ”;
      变成:

      var template = "{{%IMPLICIT-ITERATOR}}{{name}}: <ul> {{#items}}<li>{{.}}</li>{{/items}} </ul>";
      
      var-template=“{{{%IMPLICIT-ITERATOR}{{{name}}:
        {{{{items}}
      • {{.}
      • {{/items}
      ”;
      var template = "{{%IMPLICIT-ITERATOR}}{{name}}: <ul> {{#items}}<li>{{.}}</li>{{/items}} </ul>";