I use Cradle with Express and EJS on my blog. Maybe I skip smth, but some of them convert html entities to equivalents.
I have html in the doc.quote field and after that piece of code it changes
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" variable - an array that has objects with the "content" field (with html). But after rendering, "str" has "quotation marks [i] .value.quote" characters converted to its essence, for example <br> to <br>
source
share