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

Inappropriate Partial Template Parameter Replacement #59

Closed
KesshoRyu opened this issue Jan 7, 2013 · 4 comments
Closed

Inappropriate Partial Template Parameter Replacement #59

KesshoRyu opened this issue Jan 7, 2013 · 4 comments

Comments

@KesshoRyu
Copy link

If you have a partial with parameters, all instances of the parameter name get replaced in the output even if they aren't surrounded with templating syntax (such as interpolate):

{{##def.sayhello:greeting:
<div class='greeting'>{{=greeting}}</div>
#}}

{{#def.sayhello:it.something}}

will produce:

function anonymous(it) {var out='<div class=\'it.something\'>'+(it.something)+'</div>';return out;}

instead of:

function anonymous(it) {var out='<div class=\'greeting\'>'+(it.something)+'</div>';return out;}
@KesshoRyu
Copy link
Author

Any comments on this? I've come up with some interesting ways to use this as a feature but I don't know if this was intentional so I'm afraid to use it.

@strrchr
Copy link

strrchr commented Jan 7, 2016

{{##def.sayhello:greeting111:
<div class='greeting'>{{=greeting111}}</div>
#}}

{{#def.sayhello:it.something}}

The parameter of partial is just a simple word replacement.
So you should keep it unique in the partial content.

@epoberezkin
Copy link
Collaborator

I am using this "feature" a lot, it is convenient in some cases. So I am not sure we need to change it. Maybe document and explain.

@epoberezkin
Copy link
Collaborator

Add to doT 101 #205

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

No branches or pull requests

4 participants