Mustache.js: Partial do not inherit indentation.

Created on 19 Apr 2016  路  9Comments  路  Source: janl/mustache.js

var mustache = require("mustache")
var tmpl = "\t{{> test}}"
var data = {}
var partials = {"test": "Tested\nMulti line"}
console.log(mustache.render(tmpl, data, partials))

(NodeJS)

this printed

    Tested
Multi line

but i was expecting.

    Tested
    Multi line
Bug

Most helpful comment

Any update?

All 9 comments

Beautiful code have proper indentation.

Interesting, I didn't know about that part of the spec. We probably don't have any tests for that. Thanks for pointing it out!

Any update?

could you fix this?
or ist there a workaround for that ?

Could other mustache implementations solve it?
This feature is necessary for generating indentation based blocks.

I am proposing a solution (in the above PR) which fully complies with the partials spec.
The solution includes tests to all the scenarios described in the spec.
If anyone can review and merge this issue can be closed

As indicated in the PR, I decided to take @kevindew 's solution and merged it with the partial spec tests I've added.
Now it looks much better.
Please review

@phillipj - can you help reviewing the solution for this issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zekth picture zekth  路  18Comments

amper5and picture amper5and  路  5Comments

Immortalin picture Immortalin  路  12Comments

SmasherHell picture SmasherHell  路  18Comments

connor11528 picture connor11528  路  3Comments