Skip to content
This repository has been archived by the owner on Jan 26, 2019. It is now read-only.

Fix handling of @root helper arguments #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

majortom731
Copy link

I've noticed that using helper arguments in @root... notation causes an error.

This is an attempt to fix it by simply allowing '@' as first char in the $name_chunks regexp in Arguments->parse().

What do you think?

@fzerorubigd
Copy link
Member

@majortom731 Thank you!

@JustBlackBird LGTM , could you verify this too? thank you.

@JustBlackBird
Copy link
Contributor

Frankly, I'm not sure Handlebars.js allow to use @ character freely. @majortom731 could you please provide a JS fiddle that illustrates behavior of Handlebars.js?

@majortom731
Copy link
Author

Right, @ is reserved for special variables like @key, @Index or @root. We should make @root a real special variable then.

@JustBlackBird
Copy link
Contributor

@majortom731 actually @ is used for private variables. See http://handlebarsjs.com/block_helpers.html#hash-arguments for details. I believe we should fix arguments parsing at the same time we add support for private variables.

@fzerorubigd
Copy link
Member

@JustBlackBird, the private variables are already supported as special variables, do I miss something?

@JustBlackBird
Copy link
Contributor

@fzerorubigd sorry for the late answer, I had no enough time to manage issues, but now I'm back.

As I see, the current implementation of Handlebars.php supports only limited set of private variables, namely @index, @key, @first and @last (correct me if I've missed something). At the same time, Handlebars.js allow to use own custom private variables by defining them in block helpers. So there is a certain amount of work we should do here.

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

Successfully merging this pull request may close these issues.

3 participants