refactor: small Divi tree helpers out of DiviWriter (M3)

Block::isPlaceholder replaces the divi/placeholder literals (ledger T4);
NodeIndex::parentBlock/sectionLabel replace the two parentBlock copies and
DiviWriter::sectionLabel; DiviChange::idOf and Outline::summary replace the
duplicated id resolution and outline text; DiviSchema holds the shared
input properties. Behaviour unchanged.

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 18:24:29 +02:00
co-authored by Claude Opus 5.5
parent ecfece719d
commit d2cc82f31b
18 changed files with 188 additions and 86 deletions
@@ -82,6 +82,22 @@ final class OutlineTest extends TestCase
self::assertTrue($outline->wasTruncated());
}
public function testSummaryOfThePageOrOfSections(): void
{
$index = NodeIndex::build((new Parser())->parse($this->fixture('synthetic-basic.html')));
$outline = new Outline();
self::assertSame(
['text' => $outline->text($outline->rows($index)), 'truncated' => false],
$outline->summary($index)
);
self::assertSame(
$outline->text($outline->rows($index, 's0')) . "\n" . $outline->text($outline->rows($index, 's1')),
$outline->summary($index, ['s0', 's1'])['text']
);
self::assertSame(['text' => null, 'truncated' => false], $outline->summary($index, []));
}
public function testReadOnlyNodesAreMarked(): void
{
$index = NodeIndex::build((new Parser())->parse($this->fixture('synthetic-mixed.html')));