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

Need to support ID's in partial names #76

Closed
machty opened this issue Jul 1, 2013 · 2 comments
Closed

Need to support ID's in partial names #76

machty opened this issue Jul 1, 2013 · 2 comments

Comments

@machty
Copy link
Owner

machty commented Jul 1, 2013

Wait til after #75 is done, but need Emblem equivalent for handlebars-lang/handlebars.js#519

@machty
Copy link
Owner Author

machty commented Aug 19, 2013

@decasia This is all yours, should be pretty easy to do. Seems like you'll want to do something pretty similar to this PR: handlebars-lang/handlebars.js#526 I haven't looked too much into it, but should be decently straightforward. I'll help along the way if you have any questions.

@decasia
Copy link

decasia commented Sep 3, 2013

Hi @machty, sorry to take two weeks to get back to this. But do you think you could take a quick glance at my first stab at this patch here? I added a unit test for the expanded issues, which currently passes, but there are still two outstanding issues:

  1. It supports $ and . in partial names just fine, but it doesn't handle slashes correctly. I think Handlebars rewrites slashes in partial names as periods, but I don't know much about Handlebars internals so I'm not sure.
  2. The larger issue: It looks like the Handlebars folks only very briefly handled this issue by updating the regex. The first accepted patch was this but the second one was (this)[https://github.com/wycats/handlebars.js/commit/da2aabe7bdc75e29178d920332fad9de183de8a0]. The second patch does away with the partial name regex altogether, and instead redefines partialName like so:
partialName
  : path { $$ = new yy.PartialNameNode($1); }
  | STRING { $$ = new yy.PartialNameNode(new yy.StringNode($1)); }
  | INTEGER { $$ = new yy.PartialNameNode(new yy.IntegerNode($1)); }
  ;

I assume we could do something similar in Emblem's legacyPartialName definition but I'm not familiar enough with PegJS grammar rules to quite understand how to write that. Can you give me any tips?

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

3 participants