Last 12 weeks · 0 commits
1 of 6 standards met
If I receive from my client a string with "Hello\nHow are you?"... Then: 1) If I do the job to replace \n by then the string that appears on the browser is: HelloHow are you? 2) If I don't replace anything, then (of course :) the string in the browser is: Hello\nHow are you? So my question is: How you guys handle the line breaking without going to go for too complex code in .ejs placeholders? Thanks, Sebastien PS: is not the right html tag for break line, I write it like this to keep it displayed in this editor
Repository: tj/ejs. Description: Embedded JavaScript templates for node Stars: 4463, Forks: 501. Primary language: JavaScript. Languages: JavaScript (99.2%), Makefile (0.8%). Open PRs: 37, open issues: 80. Last activity: 2y ago. Community health: 28%. Top contributors: tj, mde, der-On, JacksonTian, zerowidth, jtsay362, slaskis, mako-taco, glsh-machine, domachine and others.
From the example in the README This code, in all situations, always results in an error if you don't pass the data to the file. I am trying to use it as, let's say, a report about whether your password was valid - if it wasn't I would render the file with But if the user were going to the login page and it hadn't yet been posted, I would just use: I could fix this by explicitly sending a msg = null to all routes, but I think that is silly. Any advice on how to properly handle this? My guess is that what I am doing is somehow unconventional in node/ejs. Thanks a bunch, Keith
Hi, I would propose few optimizations: 1) Use implicit string conversion, instead of String constructor. Especially if the expected input is string, like in functions: capitalize, downcase, upcase, truncate, truncate_words and replace (jsperf test: http://jsperf.com/implicitstringconversion) 2) Instead of js.substr(0,1), use equivalent js[0].