Commit 3fee490
committed
Blocks: Introduce WP_Block_Scanner for efficiently parsing blocks.
The Block Scanner follows the HTML API in providing a streaming,
near-zero-overhead, lazy, re-entrant parser for traversing block
structure. This class provides an alternate interface to
`parse_blocks()` which is more amenable to a number of common
server-side operations on posts, such as:
- Generating an excerpt from only the first N blocks in a post.
- Determining which block types are present in a post.
- Determining which posts contain a block of a given type.
- Generating block supports content for a post.1 parent 4892d46 commit 3fee490
File tree
6 files changed
+3224
-2
lines changed- src
- wp-includes
- tests/phpunit/tests/block-processor
6 files changed
+3224
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | | - | |
| 269 | + | |
270 | 270 | | |
| 271 | + | |
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2376 | 2376 | | |
2377 | 2377 | | |
2378 | 2378 | | |
| 2379 | + | |
| 2380 | + | |
| 2381 | + | |
| 2382 | + | |
| 2383 | + | |
| 2384 | + | |
| 2385 | + | |
| 2386 | + | |
| 2387 | + | |
| 2388 | + | |
| 2389 | + | |
2379 | 2390 | | |
2380 | 2391 | | |
2381 | 2392 | | |
| |||
0 commit comments