-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Parsing: Enforce block naming requirements consistently #3521
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3521 +/- ##
==========================================
+ Coverage 34.54% 35.62% +1.08%
==========================================
Files 261 262 +1
Lines 6710 6896 +186
Branches 1225 1286 +61
==========================================
+ Hits 2318 2457 +139
- Misses 3704 3738 +34
- Partials 688 701 +13
Continue to review full report at Codecov.
|
blocks/api/post.pegjs
Outdated
ASCII_AlphaNumeric | ||
= ASCII_Letter | ||
ASCII_LowercaseAlphaNumeric | ||
= ASCII_LowercaseLetter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems a bit verbose. what if instead we ripped out the whole ASCII
nomenclature and just simplified down to something like Block_Name
or Block_Name_Part
- we're not using the other rules so we can get rid of them
Namespaced_Block_Name
= $( Block_Name_Part "/" Block_Name_Part )
Core_Block_Name
= type:Block_Name_Part { return 'core/' + type }
Block_Name_Part
= $([a-z] [a-z0-9_-]*)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems a bit verbose. what if instead we ripped out the whole
ASCII
nomenclature and just simplified down to something likeBlock_Name
orBlock_Name_Part
Sounds good to me. Applied in df43eb4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks nice!
This pull request seeks to resolve inconsistencies between block registration validation and name parsing expectations. Specifically:
Further, these requirements were not documented in block registration documentation.
The proposed changes remedies each of the above issues.
Testing instructions:
Ensure tests pass:
Follow-up Tasks:
Gutenberg examples have names beginning with numbers and must be updated:
https://github.com/WordPress/gutenberg-examples