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

Regression[3.0.2]: partials not working as intended after upgrading to version 3.0.2 #712

Closed
wol-soft opened this issue Aug 26, 2019 · 5 comments · Fixed by #714
Closed

Comments

@wol-soft
Copy link
Contributor

Hi,

after upgrading to mustache.js 3.0.2 a component of my application failed to render a template which uses partials.

I copied the affected parts of the application into a JSFiddle (https://jsfiddle.net/z1jq2pu5/13/) to reproduce the error. The current result of the fiddle looks like:
image

With version 3.0.1 it looked like (can be reproduced by simply changing the CDN URL which includes mustache.js into the JSFiddle):
image

My application breaks with a message (which I can't reproduce in the JSFiddle somehow), may be helpful:

Error: Unclosed tag at 21
    at parseTemplate (VM448557 beerplop-game-1.59.3.min.js:17)
    at Writer.parse (VM448557 beerplop-game-1.59.3.min.js:17)
    at Writer.render (VM448557 beerplop-game-1.59.3.min.js:17)
    at subRender (VM448557 beerplop-game-1.59.3.min.js:17)
    at Object.<anonymous> (VM448557 beerplop-game-1.59.3.min.js:2810)
    at Writer.renderSection (VM448557 beerplop-game-1.59.3.min.js:17)
    at Writer.renderTokens (VM448557 beerplop-game-1.59.3.min.js:17)
    at Writer.renderPartial (VM448557 beerplop-game-1.59.3.min.js:17)
    at Writer.renderTokens (VM448557 beerplop-game-1.59.3.min.js:17)
    at Writer.render (VM448557 beerplop-game-1.59.3.min.js:17)

Seems like the tags of the partial aren't parsed correctly

@wol-soft wol-soft changed the title Regression[3.0.2]: partials not working as intended after upgrading to version 3.02 Regression[3.0.2]: partials not working as intended after upgrading to version 3.0.2 Aug 26, 2019
@phillipj
Copy link
Collaborator

Thanks a lot for reporting! 👍At first glance, this sounds like something we should be able to reproduce in a unit test, both for the sake of fixing it ASAP and to ensure it doesn't happen again later.

@wol-soft
Copy link
Contributor Author

Hi @phillipj, the values passed to functions are shifted by the indentation of the partial, see the tests from #713

@phillipj
Copy link
Collaborator

For future reference, this regression got introduced by #705

phillipj added a commit to phillipj/mustache.js that referenced this issue Aug 26, 2019
This small change fixes the output of functions used in partials with
indentation. Bug reports has shown that the functions output is shifted
with the amount of indentation the partial has.

The bug itself is best illustrated in the tests added in 621ae80.

Closes janl#712
phillipj added a commit to phillipj/mustache.js that referenced this issue Aug 26, 2019
This small change fixes the output of functions used in partials with
indentation. Bug reports has shown that the functions output is shifted
with the amount of indentation the partial has.

The bug itself is best illustrated in the tests added in 621ae80.

Closes janl#712
phillipj added a commit that referenced this issue Aug 27, 2019
This small change fixes the output of functions used in partials with
indentation. Bug reports has shown that the functions output is shifted
with the amount of indentation the partial has.

The bug itself is best illustrated in the tests added in 621ae80.

Closes #712
@phillipj
Copy link
Collaborator

v3.0.3 just got published to npm with a fix for this regression.

Thank you so much for your contributions! Both for reporting it and the added test cases were especially valuable! 💯

@wol-soft
Copy link
Contributor Author

I can confirm the fix works.

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

Successfully merging a pull request may close this issue.

2 participants