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

bug with function call on 0.7 #274

Closed
bubbatls opened this issue Nov 22, 2012 · 3 comments
Closed

bug with function call on 0.7 #274

bubbatls opened this issue Nov 22, 2012 · 3 comments

Comments

@bubbatls
Copy link

If I have the following code :
{{#personLink}}{{#person}}{{name}}{{/person}}{{/personLink}}
I get the error
"Unclosed section: person"
I have to use
{{#personLink}} {{#person}}{{name}}{{/person}} {{/personLink}}
with spaces for it to work good.

By the way "Unclosed section: person" does not help enougth
I had to change line 566 by
try{
return nestTokens(tokens);
}catch(e){
throw new Error(e+" "+template);
}
to help me finding what was wrong and where

@mjackson
Copy link
Contributor

mjackson commented Dec 6, 2012

I'm not able to reproduce this issue. In a node console I can run:

> var p = mustache.parse('{{#personLink}}{{#person}}{{name}}{{/person}}{{/personLink}}')
undefined
> JSON.stringify(p)
'[["#","personLink",0,15,[["#","person",15,26,[["name","name",26,34]]]]]]'

Please provide more information about how you're calling the function.

@bubbatls
Copy link
Author

bubbatls commented Dec 6, 2012

Here is the bug
Mustache.to_html(
'{{#personLink}}{{#person}}{{name}}{{/person}}{{/personLink}} ',
{
personLink:function(){
return function(text,render){
return "a"+render(text)+"/a";
};
},
person : {name : 'me'}
}
);
it causes Error: Unclosed section: 'person' {{#person}}{{name}}
If I use '{{#personLink}} {{#person}}{{name}}{{/person}} {{/personLink}} '
I have the expected result a me /a (with spaces)

@mjackson
Copy link
Contributor

Thanks for this bug report. It was a subtle bug! This is fixed in version 0.7.2.

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

No branches or pull requests

2 participants