RandomEtc / ejs-locals

Express 3.x layout, partial and block template functions for the EJS template engine.
298 stars 63 forks source link

block('name', 'html') actually returns HTML #26

Closed naholyr closed 11 years ago

naholyr commented 11 years ago

That should not be the case, because it keeps users to use <%- block(…) -%> to remove linefeeds around the call to block() when we simply use <% block(…) %>.

From documentation it seems clear it's an instruction and therefore will return nothing and can safely be called with that kind of brackets ;)

There may be either a fix in documentation (if the behavior is desired and should be kept), or a fix in the behavior. What's your call?

RandomEtc commented 11 years ago

I don't remember if that was deliberate or not. If you fix it and the tests pass I'll happily merge it.

naholyr commented 11 years ago

OK on my way then ;)

naholyr commented 11 years ago

We not really a bug, but mainly a misunderstanding of EJS-escaping: we cannot slurp newlines on the left, that's it. <%- is meant for unescaping and that's all. What I wanted to achieve (slurp left + right) is just impossible and the best I could do would have been <% block(…) -%>.

Not sure it should be fixed then. Your call again?

RandomEtc commented 11 years ago

My call would be not to worry about it. I've stopped using this library myself (in favor of http://ectjs.com which has more of the features I need).