Skip to content

Commit 5139073

Browse files
Function pages See Also
1 parent 14b73b9 commit 5139073

9 files changed

+91
-16
lines changed

web/src/components/SeeAlsoSection.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ const { seeAlsoLinks, currentId } = Astro.props;
1919
{group.links.map((link) => (
2020
<li>
2121
{link.name === currentId ? (
22-
<strong>{link.name}</strong>
22+
<strong>{link.name.replace(/_/g, ' ')}</strong>
2323
) : (
24-
<a href={link.link}>{link.name}</a>
24+
<a href={link.link}>{link.name.replace(/_/g, ' ')}</a>
2525
)}
2626
</li>
2727
))}

web/src/pages/Client_Scripting_Events.astro

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
4+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
35
import { getEventsByTypeByCategory } from '@src/utils/events';
46
57
const eventsByTypeByCategory = getEventsByTypeByCategory();
@@ -24,4 +26,13 @@ const theseEvents = eventsByTypeByCategory.client;
2426
</details>
2527
</section>
2628
))}
29+
30+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
31+
'article:Scripting_Events',
32+
'article:Server_Scripting_Events',
33+
'article:Scripting_Functions',
34+
'article:Client_Scripting_Functions',
35+
'article:Server_Scripting_Functions',
36+
'article:Shared_Scripting_Functions',
37+
])} currentId='' />
2738
</StarlightPage>

web/src/pages/Client_Scripting_Functions.astro

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
4+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
35
import { getFunctionsByTypeByCategory } from '@src/utils/functions';
46
57
const functionsByTypeByCategory = getFunctionsByTypeByCategory();
@@ -24,4 +26,13 @@ const theseFunctions = functionsByTypeByCategory.client;
2426
</details>
2527
</section>
2628
))}
29+
30+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
31+
'article:Scripting_Functions',
32+
'article:Shared_Scripting_Functions',
33+
'article:Server_Scripting_Functions',
34+
'article:Scripting_Events',
35+
'article:Client_Scripting_Events',
36+
'article:Server_Scripting_Events',
37+
])} currentId='' />
2738
</StarlightPage>

web/src/pages/Scripting_Events.astro

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
4+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
35
import { getEventsByCategory, getEventTypePretty } from '@src/utils/events';
46
const eventsByCategory = getEventsByCategory();
57
---
@@ -23,6 +25,16 @@ const eventsByCategory = getEventsByCategory();
2325
</details>
2426
</section>
2527
))}
28+
29+
30+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
31+
'article:Client_Scripting_Events',
32+
'article:Server_Scripting_Events',
33+
'article:Scripting_Functions',
34+
'article:Shared_Scripting_Functions',
35+
'article:Client_Scripting_Functions',
36+
'article:Server_Scripting_Functions',
37+
])} currentId='' />
2638
</StarlightPage>
2739

2840
<script>

web/src/pages/Scripting_Functions.astro

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
4+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
35
import { getFunctionsByCategory, getFunctionInfo } from '@src/utils/functions';
46
57
const functionsByCategory = getFunctionsByCategory();
@@ -26,4 +28,12 @@ const functionsByCategory = getFunctionsByCategory();
2628
</details>
2729
</section>
2830
))}
31+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
32+
'article:Shared_Scripting_Functions',
33+
'article:Client_Scripting_Functions',
34+
'article:Server_Scripting_Functions',
35+
'article:Scripting_Events',
36+
'article:Client_Scripting_Events',
37+
'article:Server_Scripting_Events',
38+
])} currentId='' />
2939
</StarlightPage>

web/src/pages/Server_Scripting_Events.astro

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
4+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
35
import { getEventsByTypeByCategory } from '@src/utils/events';
46
57
const eventsByTypeByCategory = getEventsByTypeByCategory();
@@ -24,4 +26,12 @@ const theseEvents = eventsByTypeByCategory.server;
2426
</details>
2527
</section>
2628
))}
29+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
30+
'article:Scripting_Events',
31+
'article:Client_Scripting_Events',
32+
'article:Scripting_Functions',
33+
'article:Shared_Scripting_Functions',
34+
'article:Client_Scripting_Functions',
35+
'article:Server_Scripting_Functions',
36+
])} currentId='' />
2737
</StarlightPage>

web/src/pages/Server_Scripting_Functions.astro

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
4+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
35
import { getFunctionsByTypeByCategory } from '@src/utils/functions';
46
57
const functionsByTypeByCategory = getFunctionsByTypeByCategory();
@@ -24,4 +26,13 @@ const theseFunctions = functionsByTypeByCategory.server;
2426
</details>
2527
</section>
2628
))}
29+
30+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
31+
'article:Scripting_Functions',
32+
'article:Shared_Scripting_Functions',
33+
'article:Client_Scripting_Functions',
34+
'article:Scripting_Events',
35+
'article:Client_Scripting_Events',
36+
'article:Server_Scripting_Events',
37+
])} currentId='' />
2738
</StarlightPage>
Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
---
22
import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
3+
import { getSeeAlsoLinksFromList } from '@src/utils/general';
4+
import SeeAlsoSection from '@src/components/SeeAlsoSection.astro';
35
import { getFunctionsByTypeByCategory } from '@src/utils/functions';
46
57
const functionsByTypeByCategory = getFunctionsByTypeByCategory();
@@ -10,19 +12,27 @@ const theseFunctions = functionsByTypeByCategory.shared;
1012
title: 'Shared functions',
1113
tableOfContents: false,
1214
}}>
15+
<p>This page lists all <strong>shared</strong> functions available in the <a href="/lua-api">Lua API</a> organized by category.</p>
1316

14-
<p>This page lists all <strong>shared</strong> functions available in the <a href="/lua-api">Lua API</a> organized by category.</p>
17+
{Object.entries(theseFunctions).map(([category, funcs]) => (
18+
<section>
19+
<details>
20+
<summary>{category} functions</summary>
21+
<ul>
22+
{funcs.map(func => (
23+
<li><a href={`/${func.id}`}>{func.id}</a></li>
24+
))}
25+
</ul>
26+
</details>
27+
</section>
28+
))}
1529

16-
{Object.entries(theseFunctions).map(([category, funcs]) => (
17-
<section>
18-
<details>
19-
<summary>{category} functions</summary>
20-
<ul>
21-
{funcs.map(func => (
22-
<li><a href={`/${func.id}`}>{func.id}</a></li>
23-
))}
24-
</ul>
25-
</details>
26-
</section>
27-
))}
30+
<SeeAlsoSection seeAlsoLinks={getSeeAlsoLinksFromList([
31+
'article:Scripting_Functions',
32+
'article:Client_Scripting_Functions',
33+
'article:Server_Scripting_Functions',
34+
'article:Scripting_Events',
35+
'article:Client_Scripting_Events',
36+
'article:Server_Scripting_Events',
37+
])} currentId='' />
2838
</StarlightPage>

web/src/utils/general.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function getSeeAlsoLinksFromList(seeAlsoList: string[]): SeeAlsoLinkGroup
127127
.filter(title => groupedMap.has(title))
128128
.map(title => ({
129129
title,
130-
links: groupedMap.get(title)!.sort((a, b) => a.name.localeCompare(b.name)),
130+
links: groupedMap.get(title) || [],
131131
}));
132132
}
133133

0 commit comments

Comments
 (0)