creationix / haml-js

Haml ported to server-side Javascript. This is a traditional server-side templating language. Tested with node-js
MIT License
902 stars 110 forks source link

putting inline javascript under :each breaks #55

Open lashd opened 12 years ago

lashd commented 12 years ago

example:

:each question in questions

Browser reports: missing ) after argument list

And the following is logged to the console

with (locals || {}) {
    try {
        var _$output = (function () {
            var __result__ = [], __key__, question;
            for (__key__ in questions) {
                if (questions.hasOwnProperty(__key__)) {
                    question = questions[__key__];
                    __result__.push("";
                    var temp = 'hello';
                    _$output = _$output
                )
                    ;
                }
            }
            return __result__.join("");
        }).call(this);
        return _$output;
    } catch (e) {
        return "\n<pre class='error'>" + html_escape(e.stack) + "</pre>\n";
    }
}
ilich commented 12 years ago

The issue has been fixed. 349ede189ca0171108a8546ce0b7aa27b0b20529

See the unit-test js_after_each.haml for further information.