Cradle / Express / EJS将html转换为实体

我在我的博客上使用Express和EJS的Cradle。 也许我错过了smth,但其中一些将html实体转换为其等价物。

我有doc.quote字段中的HTML,并在这段代码后,它改变

quotesDb.view('list/by_date', { 'startkey' : {}, 'endkey' : null, 'descending' : true }, function(err, res) { if (err) { r.send(); return; } r.partial('quotes', {'quotes' : res}, function(err, str) { console.log(str); sendResponse('content', str); }); }); 

quotes.ejs:

 <% for (var i=0; i<quotes.length; i++) { %> <div> <%=quotes[i].value.quote%> </div> <div class="date"> <%=(new Date(quotes[i].value.ts*1000)).toLocaleDateString()%><% if (quotes[i].value.author) { %>, <%=quotes[i].value.author%><% } %> </div> <% } %> 

“res”variables是具有“content”字段(具有html)的对象的数组。 但是在渲染“str”之后,将“quotes [i] .value.quote”符号转换为它的实体,比如说&lt; br&gt;

答案在这里find: http : //groups.google.com/group/express-js/browse_thread/thread/f488d19a1604c30e?pli=1

 <%=var%> 

用于转义呈现

 <%-var%> 

渲染而不逃脱