feat: lit/divi-replace-text with dry run and per-page tree_rev targets

TextReplacer replaces only in plain-text segments (S8 split), outside
script/style bodies, inserts the replacement cleaned per field kind and
refuses any result whose tags, entities or references differ from the
original plus the inserted text. Unchanged strings are never cleaned.
Per page all or nothing with the tree_rev lock; Throwables are reported
per page (S10).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
2026-09-26 16:16:01 +02:00
co-authored by Claude Opus 5.5
parent ede0221b50
commit d67cd0ede6
9 changed files with 1527 additions and 1 deletions
@@ -323,6 +323,20 @@ final class AttrWriterTest extends TestCase
self::assertSame('Los', ComposeFixture::attrWriter()->cleanValue('divi/button', 'button.innerContent', '<b>Los</b>'));
}
/** kindOf() names the routing cleanValue() applies (lit/divi-replace-text skips url/code). */
public function testKindOfNamesTheRouting(): void
{
$writer = ComposeFixture::attrWriter();
self::assertSame('html', $writer->kindOf('divi/text', 'content.innerContent'));
self::assertSame('text', $writer->kindOf('divi/heading', 'title.innerContent'));
self::assertSame('code', $writer->kindOf('divi/code', 'content.innerContent'));
self::assertSame('text', $writer->kindOf('divi/fullwidth-header', 'buttonOne.innerContent', 'text'));
self::assertSame('url', $writer->kindOf('divi/fullwidth-header', 'buttonOne.innerContent', 'linkUrl'));
self::assertSame('text', $writer->kindOf('divi/image', 'image.innerContent', 'alt'));
self::assertSame('url', $writer->kindOf('divi/image', 'image.innerContent', 'src'));
}
/** Ruling S24: keys below a scalar-kind path are unknown; a …Url path segment means URL. */
public function testKeysBelowScalarKindsAndUrlPathSegments(): void
{