documentcloud/underscore — Issue #369: bug: missing semicolon in template (with fix)
Author: alexeypetrushin
Created: 2011-11-13 22:42:05+00:00
State: open

If You try to compile this template You got error "missing ; before statement".

``` Erb
<% _.each([1, 2], function(v){ %>
<%= v %>
<% }) %>
```

because we didn't write semicolon after the `<% }) %>` statement. But It can be automatically fixed if we add semicolon to this snipped of template generation code:

``` JavaScript
.replace(c.evaluate || null, function(match, code) {
return "');" + code.replace(/\\'/g, "'")
.replace(/[\r\n\t]/g, ' ') + "__p.push('";
})
```

if we replace `"__p.push('"` with `"; __p.push('"` the problem will be solved.