Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial do not inherit indentation. #562

Closed
kuldeepdhaka opened this issue Apr 19, 2016 · 9 comments
Closed

Partial do not inherit indentation. #562

kuldeepdhaka opened this issue Apr 19, 2016 · 9 comments
Labels

Comments

@kuldeepdhaka
Copy link

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
@kuldeepdhaka
Copy link
Author

Beautiful code have proper indentation.

@kuldeepdhaka
Copy link
Author

@dasilvacontin
Copy link
Collaborator

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!

kevindew added a commit to kevindew/mustache.js that referenced this issue Dec 3, 2016
As referenced in this issue:
janl#562

Partials aren't indented as per the spec:
https://github.com/mustache/spec/blob/master/specs/partials.yml#L13-L15

This adds indentation tracking for partials and applies them to the
first instance of a partial on a line (to not indent inline partials
which would violate a different part of the spec).
@brettstack
Copy link

Any update?

@idefixcert
Copy link

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

@balazser
Copy link

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

@yotammadem
Copy link
Contributor

yotammadem commented Jun 26, 2019

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

@yotammadem
Copy link
Contributor

yotammadem commented Jun 27, 2019

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?

phillipj pushed a commit that referenced this issue Aug 21, 2019
As referenced in this issue:
#562

Partials aren't indented as per the spec:
https://github.com/mustache/spec/blob/master/specs/partials.yml#L13-L15

This adds indentation tracking for partials and applies them to the
first instance of a partial on a line (to not indent inline partials
which would violate a different part of the spec).
@phillipj
Copy link
Collaborator

This got fixed in #705.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants