fix: anchor Divi name/id patterns at string end, number-advanced stays unknown, doc wording

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-26 13:16:20 +02:00
co-authored by Claude Opus 5.5
parent 4356e69bb9
commit c24b91d8a5
8 changed files with 13 additions and 8 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ use stdClass;
final class Block extends Container
{
/** A valid block name: "namespace/block-name" (WordPress' own block name convention). */
private const NAME_PATTERN = '/^[a-z][a-z0-9_-]*\/[a-z][a-z0-9_-]*$/';
private const NAME_PATTERN = '/^[a-z][a-z0-9_-]*\/[a-z][a-z0-9_-]*$/D';
/**
* @param array<string, mixed> $attrs
@@ -14,7 +14,7 @@ namespace LIT\MCP\Integrations\Divi\BlockTree;
*/
final class NodeIndex
{
public const ID_PATTERN = '/^[srcmgx]\d+(\.[srcmgx]\d+)*$/';
public const ID_PATTERN = '/^[srcmgx]\d+(\.[srcmgx]\d+)*$/D';
/** @var array<string, Block> */
private array $byId = [];
@@ -9,7 +9,7 @@ namespace LIT\MCP\Integrations\Divi\BlockTree;
* delimiters; changed or new blocks get delimiters generated exactly like WordPress'
* get_comment_delimited_block_content() / serialize_block_attributes() do, which also
* yields the escaping Divi expects inside $variable(…)$ payloads: json_encode()'s own
* \" (an escaped quote inside a JSON string) is replaced by ", see ESCAPES below.
* \" (an escaped quote inside a JSON string) is replaced by \u0022, see ESCAPES below.
*/
final class Serializer
{