Closed char101 closed 4 years ago
Indeed, pugjs is right to disallow new lines inside interpolation, as it would be very unsafe to use them.
Pugjs disallow interpolations #{}
and tag interpolations #[]
the same way. But multi-line interpolation can be a convenient feature for expressions:
- var foo = [9, 5];
p.
start #{foo.reduce(function (i, n) {
return i + n;
}, 7)} end
Disallowing this would be a breaking change as some users could legitimately think this was allowed.
This means (at least for the expression part), this could be kept as is or should be an opt-in.
With the version 1.8.0:
#[\n]
will throw a dedicated exception.#{\n}
will throw a dedicated exception if 'multiline_interpolation'
option is set to false
.
Hello,
I encountered an issue with the following code:
I expected to get:
But I actually get:
Thanks!