$self, "{{BASE_URL}}" => handbookBaseUrl(), "{{PAGE_COUNT}}" => (string) count(handbookPages()), "{{TOTAL_SIZE}}" => handbookFormatBytes($total), ]); // ---- Recipes: the shortlist per job ------------------------------------ $out[] = "## What Each Page Is For\n"; foreach (handbookRecipes() as $recipe) { $lines = ["### " . $recipe["title"], "", $recipe["note"], ""]; foreach ($recipe["pages"] as [$kind, $key]) { $page = handbookPage($kind, $key); if ($page === null) { continue; } $lines[] = "- " . handbookRawUrl($page) . " – " . $page["title"]; } $out[] = implode("\n", $lines) . "\n"; } // ---- Every page -------------------------------------------------------- $out[] = handbookRenderList( "## Documentation", "Chapters in the recommended reading order.", $docs, ); $out[] = "## Interface\n\n" . "- " . $self . "/openapi.php – OpenAPI 3.1 of the Manage server's four endpoints, " . "as JSON. Read together with the *Protocol v1* chapter for a custom client.\n" . "- " . $self . "/api.php – the same description in Swagger UI. A page for " . "humans, no use to a program.\n"; $out[] = handbookRenderList( "## Source Code", "The complete client package, every file individually retrievable. Integrating it " . "needs the folder `manage-client/`; `examples/`, `docs/` and `scripts/` " . "are not part of that.", $code, ); $vendored = handbookVendoredFiles(); if ($vendored !== []) { $lines = ["## Not Reproduced Here", "", "Third-party libraries that are part of the " . "package but don't have a page here:", ""]; foreach ($vendored as $relative => $bytes) { $lines[] = "- `client-package/" . $relative . "` (" . handbookFormatBytes($bytes) . ")"; } $out[] = implode("\n", $lines) . "\n"; } return implode("\n", $out); } /** @param array $pages */ function handbookRenderList(string $heading, string $intro, array $pages): string { $lines = [$heading, "", $intro, ""]; foreach ($pages as $page) { $lines[] = "- " . handbookRawUrl($page) . " (" . handbookFormatBytes($page["bytes"]) . ")" . " – **" . $page["title"] . "**" . ($page["summary"] !== "" ? ". " . $page["summary"] : ""); } return implode("\n", $lines) . "\n"; }