Skip to content

Commit 0d01c06

Browse files
committed
update API generator with new urls
1 parent 876d9d6 commit 0d01c06

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

build/src/php/FileGenerator/Application/ApiMarkdownGenerator.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace PhelDocBuild\FileGenerator\Application;
66

77
use Phel\Api\ApiFacadeInterface;
8+
use Phel\Api\Transfer\PhelFunction;
89

910
final readonly class ApiMarkdownGenerator
1011
{
@@ -19,13 +20,18 @@ public function __construct(
1920
public function generate(): array
2021
{
2122
$result = $this->zolaHeaders();
23+
24+
/** @var list<PhelFunction> $groupedPhelFns */
2225
$groupedPhelFns = $this->apiFacade->getPhelFunctions();
2326

2427
foreach ($groupedPhelFns as $fn) {
25-
$result[] = "## `{$fn->fnName()}`";
28+
$result[] = "## `{$fn->name()}`";
29+
$result[] = "<small><strong>Namespace</strong> `{$fn->namespace()}`</small>";
2630
$result[] = $fn->doc();
27-
if ($fn->url() !== '') {
28-
$result[] = sprintf('<small>[[View source](%s)]</small>', $fn->url());
31+
if ($fn->githubUrl() !== '') {
32+
$result[] = sprintf('<small>[[View source](%s)]</small>', $fn->githubUrl());
33+
}elseif ($fn->docUrl() !== '') {
34+
$result[] = sprintf('<small>[[Read more](%s)]</small>', $fn->docUrl());
2935
}
3036
}
3137

build/src/php/FileGenerator/Application/ApiSearchGenerator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
final readonly class ApiSearchGenerator
1010
{
11-
private const SPECIAL_ENDING_CHARS = ['=', '*', '?', '+', '>', '<', '!'];
11+
private const array SPECIAL_ENDING_CHARS = ['=', '*', '?', '+', '>', '<', '!'];
1212

1313
public function __construct(
1414
private ApiFacadeInterface $apiFacade
@@ -51,9 +51,9 @@ public function generateSearchIndex(): array
5151
}
5252

5353
$result[] = [
54-
'id' => 'api_' . $fn->fnName(),
55-
'fnName' => $fn->fnName(),
56-
'fnSignature' => $fn->fnSignature(),
54+
'id' => 'api_' . $fn->name(),
55+
'fnName' => $fn->name(),
56+
'fnSignature' => $fn->signature(),
5757
'desc' => $this->formatDescription($fn->description()),
5858
'anchor' => $anchor,
5959
'type' => 'api',

composer.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)