Jade 向数据变量添加引号

Jade adding quote to data variable

出于某种原因,当 _id 字符串未与空字符串连接时,Jade 似乎将双引号的 HTML 实体添加到它的开头和结尾。

翡翠:

var post = {_id: ObjectId("551ce90c036474a3805e30cf")};
button(data-id=post._id, data-action='give') Give

HTML:

<button data-id="&quot;551ce90c036474a3805e30cf&quot;" data-action="give">Give</button>

翡翠:

var post = {_id: ObjectId("551ce90c036474a3805e30cf")};
button(data-id='' + post._id, data-action='give') Give

HTML:

<button data-id="551ce90c036474a3805e30cf" data-action="give">Give</button>``

有没有办法解决这个问题,还是我做错了什么?

post._id 是一个 object which gets stringify'ed 导致引号。

使用post.id默认为字符串。