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

Get page variable in nested block helpers #62

Closed
LaurentGoderre opened this issue Sep 12, 2013 · 5 comments
Closed

Get page variable in nested block helpers #62

LaurentGoderre opened this issue Sep 12, 2013 · 5 comments

Comments

@LaurentGoderre
Copy link
Contributor

Someone discovered an issue with the i18n task that I'm trying to resolve. Given the current code:

{{#prettify}}
  {{#i18n "key"}}{{/i18n}}
{{/prettify}}

The i18n fails because it no longer sees the language parameter of the page. I'm wondering, how do I get access to the page regardless of where the block is.

@LaurentGoderre
Copy link
Contributor Author

Or in other words, how do I programmatically get the root context from within a helper.

@jonschlinkert
Copy link
Member

The prettify helper shouldn't be changing context, so I'm not sure why that's happening. When I get a chance this evening I'll try to see why that's happening. @doowb any thoughts?

how do I get access to the page regardless of where the block is.

and

how do I programmatically get the root context from within a helper.

This is an ongoing issue that has been raised with Handlebars. handlebars-lang/handlebars.js#392.

That being said, on the topic of context, to date I can't think of anything we've wanted to achieve where we weren't able to find a way around it. so we'll get this figured out.

@jonschlinkert
Copy link
Member

oh, I should have mentioned that if necessary we can implement prettify into Assemble's core. i18n is an important part of your project, and IMO if the helper is causing an issue that isn't resolvable otherwise, that's as compelling of a reason as I need to do it. of course, the handlebars context issue won't go away in general, but at least it won't a problem here.

@LaurentGoderre
Copy link
Contributor Author

Through the console I found that the context for prettify is the grunt parameters for prettify

@jonschlinkert
Copy link
Member

I'm assuming this has been resolved? @LaurentGoderre please reopen if necessary.

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