squirrellyjs / squirrelly

Semi-embedded JS template engine that supports helpers, filters, partials, and template inheritance. 4KB minzipped, written in TypeScript ⛺
https://squirrelly.js.org
MIT License
555 stars 81 forks source link

template variable at end of line consumes newline #237

Closed milahu closed 1 year ago

milahu commented 2 years ago

template variable at end of line consumes newline

template

These fruits are amazing:

{{@each(it.fruits) => fruit}}

fruit = {{fruit}}
fruit = {{fruit}}

{{/each}}

actual result

These fruits are amazing:

fruit = Applefruit = Apple
fruit = Pearfruit = Pear
fruit = Orangefruit = Orange
fruit = Lemonfruit = Lemon

expected result

These fruits are amazing:

fruit = Apple
fruit = Apple
fruit = Pear
fruit = Pear
fruit = Orange
fruit = Orange
fruit = Lemon
fruit = Lemon

environment

https://squirrelly.js.org/playground/

Kukunin commented 1 year ago

I had the same issue. Fixed by using autoTrim: false configuration

milahu commented 1 year ago

thanks : )

closing as fixed