unexpectd indent
peachest opened this issue · comments
peachest commented
test.mustache:
env: {
{{#env}}{{#es6}}es6: true,
{{/es6}}{{#jasmine}}jasmine: true,
{{/jasmine}}{{/env}}
}
I store this file locally and use const template = fs.readFileSync().toString()
to get the template text.
view:
const view = {
env: {
es6: true,
}
}
// or
const view = {
env: {
es6: true,
jasmine: true,
}
}
When I execute mustache.render(template, view)
, I got the following output:
env: {
es6: true,
}
The indent of the end bracket is unexpectd.
expect:
env: {
es6: true,
}
// or
env: {
es6: true,
jasmine: true,
}
However, if I insert a linebreak after the tag in test.mustache
, just like the following:
env: {
{{#env}}{{#es6}}es6: true,
{{/es6}}{{#jasmine}}jasmine: true,
{{/jasmine}}{{/env}}
}
then I got:
env: {
es6: true,
}
Now the indent of the bracket is right, but I got an extra empty line which is also unexpected.
I wonder why I got these result ? Is the way I read the .mustaache
file wrong ?
Also may anybody provide a beautiful solution for this problem.