-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
each
should recognize iteration protocol objects
#3170
Comments
This will require us to adopt some new syntax. I would suggest something like |
@strugee Are you currently working on a PR for this? Because if not I'd be happy to take it on. |
@maxrumsey I've marked it as being worked on. Based on the assumption that one of you or @strugee will be working on it :) |
@maxrumsey I am not. If no one lands this I'll probably eventually prepare patches just because I want this in my own projects, but I'm not doing anything right now and would be thrilled if someone else implemented this for me :-) |
Yeah I'd be happy to take a stab at this! |
@ForbesLindesay Considering the size of Pug, do you have any tips for where I could get started? See the gitter chat. |
You'll need to start by building an eachOf variant of pug/packages/pug-lexer/index.js Lines 950 to 972 in fa8d287
You'll then need to handle it in the parser pug/packages/pug-parser/index.js Lines 235 to 236 in fa8d287
Finally, you'll need to generate js code for it in pug/packages/pug-code-gen/index.js Line 724 in fa8d287
|
To get a local environment setup where all the packages work together, you should use lerna |
The code to implement this has now been merged, and will be included in the next release. |
This should probably be added to the docs if it's implemented? |
Pug Version: 2.0.4
Node Version: 8.10.0
Input JavaScript Values
Input Pug
Expected HTML
Actual HTML
Additional Comments
Here's the relevant MDN documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
I would be happy to prepare a PR implementing this change but wanted to open an issue first to make sure there aren't any issues I haven't thought of yet. I also think this will be backwards-compatible pretty easily, but don't have the time to double-check at the moment. I'll do that soon.
The text was updated successfully, but these errors were encountered: