Biete Überschriften h3 bis h6 an und nimm sie ins Inhaltsverzeichnis auf
Ein Dokument gliedert sich vor allem durch Kapitel der ersten Ebene und Überschriften im Text. Der Editor bietet h3 bis h6; h1 und h2 aus eingefügtem Text werden h3. Alle Überschriften des Kapiteltexts stehen automatisch im Inhaltsverzeichnis der Seite und des PDF (eingerückt, ohne Nummer), mit Sprungmarken, im PDF mit Seitenzahl, Verweis und verschachtelten Lesezeichen. Die PDF-Gliederung kennt jetzt bis zu sechs Ebenen und zählt alle Nachkommen. Unter einem Unterkapitel rücken die Überschriften eine Stufe tiefer (höchstens h6). Der bestehende Test erwartete h4 für eine Zwischenüberschrift im Kapitel; das gilt bewusst nicht mehr (h3 bleibt h3 und trägt eine Sprungmarke). Keine Migration, der Änderungsnachweis bleibt unverändert. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
58b68b768c
commit
b942b5331a
16 files changed
+421
-51
No files matched your search
@@ -33,7 +33,7 @@ public function show(Composition $composition): View
|
||||
$images = EmbeddedImages::staff();
|
||||
|
||||
foreach ($guide['chapters'] as $index => $chapter) {
|
||||
$guide['chapters'][$index]['html'] = DocumentGuide::shiftHeadings(FormattedText::html($chapter['version']->body, $images));
|
||||
$guide['chapters'][$index]['html'] = DocumentGuide::anchoredHtml($chapter, FormattedText::html($chapter['version']->body, $images));
|
||||
}
|
||||
|
||||
return view('document.preview', ['guide' => $guide, 'composition' => $composition, 'pdfUrl' => route('editorial.document-preview.pdf', $composition)]);
|
||||
@@ -60,7 +60,7 @@ private function guide(Composition $composition): array
|
||||
abort_if($chapters === null, 404);
|
||||
|
||||
foreach ($chapters as $index => $chapter) {
|
||||
$chapters[$index] += [
|
||||
$chapters[$index] = DocumentGuide::withHeadings($chapters[$index] + [
|
||||
'allowed' => true,
|
||||
'grant' => null,
|
||||
'may_download' => true,
|
||||
@@ -68,7 +68,7 @@ private function guide(Composition $composition): array
|
||||
'state' => 'ok',
|
||||
'html' => null,
|
||||
'blocks' => FormattedText::blocks($chapter['version']->body),
|
||||
];
|
||||
]);
|
||||
}
|
||||
|
||||
$draft = app(EditorialWorkingDraft::class)->read($composition);
|
||||
@@ -95,14 +95,14 @@ public function template(PdfTemplate $template): Response
|
||||
|
||||
foreach (['Grundlagen' => 1, 'Haltung und Abstand' => 1, 'Vertiefung' => 2] as $title => $level) {
|
||||
$number = count($chapters) + 1;
|
||||
$chapters[] = [
|
||||
$chapters[] = DocumentGuide::withHeadings([
|
||||
'number' => (string) ($level === 1 ? count(array_filter($chapters, fn (array $c): bool => $c['level'] === 1)) + 1 : '2.1'),
|
||||
'level' => $level,
|
||||
'anchor' => 'muster-'.$number,
|
||||
'title' => $title,
|
||||
'allowed' => true,
|
||||
'blocks' => FormattedText::blocks('<p>'.str_repeat('Mustertext für die Vorschau der Vorlage. ', 30).'</p><h3>Zwischenüberschrift</h3>'.$table),
|
||||
];
|
||||
]);
|
||||
}
|
||||
|
||||
$guide = [
|
||||
|
||||
Reference in new issue
Block a user