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

Grammar: Reduce and rename for clarity #6127

Merged
merged 1 commit into from Apr 17, 2018

Conversation

Projects
None yet
2 participants
@mcsf
Contributor

mcsf commented Apr 11, 2018

Description

Spin-off from #6116.

Grammar changes:

  • Rename Token to Block
  • Rename Block_Void to Block_Empty
  • Port WS+ to __, merging together white-space rules

How Has This Been Tested?

Screenshots (jpeg or gifs if applicable):

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code has proper inline documentation.
Token
= Block_Void
Block
= Block_Empty

This comment has been minimized.

@dmsnell

dmsnell Apr 12, 2018

Contributor

It’s worth considering the context in which void was chosen as a name. It borrows from the HTML spec which specifies certain tags as void and those are not allowed to have a closing tag - hr, img, br, etc... in Gutenberg it’s optional the distinction between empty and void but the intention was to convey void elements, not to present an optimization for empty elements

@dmsnell

I should clarify what I was saying about Void. I approve these changes though I think it may still be worth considering not changing Void to Empty because they carry different semantic nuances.

Make your choice; I support this either way.

Grammar: Reduce and rename for clarity
* Rename Token to Block
* Rename Block_Void to Block_Empty
* Port WS+ to __
* Update PHP parser
@mcsf

This comment has been minimized.

Contributor

mcsf commented Apr 17, 2018

Thanks for the review and confidence, Dennis. Your comment on void/empty makes a lot of sense.

I'll keep Block_Void, then. What I think we'll do with/after #6116 is add comments to the rules, and one for Block_Void would include your HTML-spec-inspired reasoning, and that it "represents an empty block", so to speak. Whatever makes the grammar doc easier to read.

@mcsf mcsf merged commit 1d05c53 into master Apr 17, 2018

2 checks passed

codecov/project 43.91% remains the same compared to 6cc5db3
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@mcsf mcsf deleted the update/grammar-reduce-and-rename branch Apr 17, 2018

@dmsnell

This comment has been minimized.

Contributor

dmsnell commented Apr 17, 2018

The point is that void blocks aren’t empty blocks but thy are blocks that cannot contain content. Maybe we muddy that in our parser/serializer. If it ends up that actually we use it as a shorthand then we may actually want to rename it. Nice work in any case!

nuzzio added a commit to nuzzio/gutenberg that referenced this pull request Apr 25, 2018

Grammar: Reduce and rename for clarity (WordPress#6127)
* Rename Token to Block
* Rename Block_Void to Block_Empty
* Port WS+ to __
* Update PHP parser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment