node-asyncEJS
node-asyncEJS copied to clipboard
Double New line
I am using a template like this
html
head
title "Hello " <%= ctx.opts.layout_name %>
body
div
It generates double \n per each newline causing this output
html
head
title "Hello " ssss
body
div
Is this a bug or is there conf i missed.
My code:
te.template(view_template_file, function(template) {
var params = {
opts: opts
};
console.log({"params":params});
var templateResponse = template(params);
var file_content = [];
templateResponse.addListener("body", function(chunk) {
// chunk = chunk.replace(/\n\n/g,'\n') <-- to fix double \n
console.debug(chunk); // [DEBUG] "html\n\n head\n\n title \"Hello \" "
file_content.push(chunk);
});
templateResponse.addListener("complete", function() {
console.debug(file_content);
fs.writeFile(output_view_file, file_content.join(''), function(err) {
if(err) throw err;
console.log('It\'s saved!');
});
console.log("COMPLETE")
});
});
Thanks
Great work.
This still works with a current version of node? I'm mildly surprised :)
:o well I will check with current version. maybe I'll research the reason later. By now I will continue using that trick.