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

SmasherHell picture SmasherHell  ·  18Comments

funston picture funston  ·  7Comments

MatthijsZw picture MatthijsZw  ·  18Comments

zekth picture zekth  ·  18Comments

barbalex picture barbalex  ·  5Comments