Update PHP “parser” to recognize shorthand block syntax#1190
Merged
westonruter merged 3 commits intomasterfrom Jun 17, 2017
Merged
Update PHP “parser” to recognize shorthand block syntax#1190westonruter merged 3 commits intomasterfrom
westonruter merged 3 commits intomasterfrom
Conversation
aduth
reviewed
Jun 15, 2017
lib/blocks.php
Outdated
|
|
||
| // Extract the blocks from the post content. | ||
| $open_matcher = '/<!--\s*wp:([a-z](?:[a-z0-9\/]+)*)\s+((?:(?!-->).)*)-->.*?<!--\s*\/wp:\g1\s+-->/'; | ||
| $open_matcher = '/<!--\s*wp:([a-z](?:[a-z0-9\/]+)*)\s+((?:(?!-->).)*)\s*\/?-->(?:.*?<!--\s*\/wp:\g1\s+-->)?/'; |
Member
There was a problem hiding this comment.
Should we rename this variable since it's not necessarily applying to openings only?
Also, this could match (or fail to match) some interesting variations: https://regex101.com/r/8hi4ds/2
Member
Author
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that the Latest Posts block failed to render on the frontend at all. This is due to the block using the void syntax from #1134, which was not likewise implemented in PHP.
This change will be irrelevant once there is a proper PHP parser (see #1152 and #1086).