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

fix string not rendered in its block #1309

Closed
wants to merge 1 commit into from

Conversation

wahwahid
Copy link

When we want to check a hash is available or not, and value of hash is a string we can't get it rendered.

Example :

Template

<p>
    I want to say "{{#goodbye}}{{goodbye}}{{/goodbye}} {{#world}}{{world}}{{/world}}"
</p>

Hash

{goodbye: 'Goodbye', world: 'Complex World'}

On v4.0.5 it will render I want to say " "
After applying this it will render I want to say "Goodbye Complex World"

@nknapp
Copy link
Collaborator

nknapp commented Feb 14, 2017 via email

@wahwahid
Copy link
Author

Yeah compatibility mode does that, but it recursive lookup has performance cost.

@nknapp
Copy link
Collaborator

nknapp commented Feb 14, 2017

The default way in Handlebars would be the template

<p>
    I want to say "{{#goodbye}}{{.}}{{/goodbye}} {{#world}}{{.}}{{/world}}"
</p>

@nknapp
Copy link
Collaborator

nknapp commented Feb 14, 2017

My last comment was not completely correct. I think the actual default way in Handlebars would be

<p>
    I want to say "{{#if goodbye}}{{goodbye}}{{/if}} {{#if world}}{{world}}{{/if}}"
</p>

Using properties as a block like {{#goodbye}}... is more the Mustache way. If you can, you should use the {{#if}}- and {{#each}}-helpers, because their behavior is much more explicit.

@nknapp nknapp closed this Feb 14, 2017
@nknapp
Copy link
Collaborator

nknapp commented Feb 14, 2017

I'm closing this, because there other ways of achieving your goals and we do not want to introduce new features at the moment.

@wahwahid
Copy link
Author

wahwahid commented Feb 16, 2017

Okay i can understand. Maybe you can see this again when possible to introduce new features, because migration from original mustache will be easier than before without reduce any performance on simple template. Thank you.

@nknapp
Copy link
Collaborator

nknapp commented Feb 16, 2017 via email

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 this pull request may close these issues.

2 participants