Skip to content

Commit 75fa2bc

Browse files
committed
Show Realm icons in docs - Resolves #62
1 parent d5d9a0e commit 75fa2bc

13 files changed

+48
-28
lines changed

__tests__/api-writer/glua-api-writer.spec.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ describe('GLua API Writer', () => {
123123
],
124124
});
125125

126-
expect(api).toEqual(`---[SHARED] Explodes with an optional intensity.\n---\n---[(View on wiki)](na)\n---@param intensity? number The intensity of the explosion.\n---@return number # The amount of damage done.\nfunction _G.Explode(intensity) end\n\n`);
126+
expect(api).toEqual(`---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Explodes with an optional intensity.\n---\n---[(View on wiki)](na)\n---@param intensity? number The intensity of the explosion.\n---@return number # The amount of damage done.\nfunction _G.Explode(intensity) end\n\n`);
127127
});
128128

129129
it('should allow overriding specific page addresses', () => {
@@ -246,7 +246,7 @@ describe('GLua API Writer', () => {
246246
],
247247
});
248248

249-
expect(api).toEqual(`---[SHARED] Returns a table of all bots on the server.\n---\n---[(View on wiki)](na)\n---@return Player[] # A table only containing bots ( AI / non human players )\nfunction player.GetBots() end\n\n`);
249+
expect(api).toEqual(`---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Returns a table of all bots on the server.\n---\n---[(View on wiki)](na)\n---@return Player[] # A table only containing bots ( AI / non human players )\nfunction player.GetBots() end\n\n`);
250250
});
251251

252252
it('should not convert table<type,otherType> to type,otherType[]', () => {
@@ -268,7 +268,7 @@ describe('GLua API Writer', () => {
268268
],
269269
});
270270

271-
expect(api).toEqual(`---[SHARED] Returns a table of all bots on the server.\n---\n---[(View on wiki)](na)\n---@return table<number,Player> # A table only containing bots ( AI / non human players )\nfunction player.GetBots() end\n\n`);
271+
expect(api).toEqual(`---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Returns a table of all bots on the server.\n---\n---[(View on wiki)](na)\n---@return table<number,Player> # A table only containing bots ( AI / non human players )\nfunction player.GetBots() end\n\n`);
272272
});
273273

274274
const testFuncPart = {
@@ -298,7 +298,7 @@ describe('GLua API Writer', () => {
298298
}
299299
],
300300
},
301-
output: `---[SHARED] Just for testing.\n---\n---[(View on wiki)](na)\n---@param value string|number The value to fake.\nfunction test.Fake(value) end\n\n`,
301+
output: `---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Just for testing.\n---\n---[(View on wiki)](na)\n---@param value string|number The value to fake.\nfunction test.Fake(value) end\n\n`,
302302
},
303303
// Case with pipes in the type (prefered in wiki)
304304
{
@@ -314,7 +314,7 @@ describe('GLua API Writer', () => {
314314
}
315315
],
316316
},
317-
output: `---[SHARED] Just for testing.\n---\n---[(View on wiki)](na)\n---@param value string|number The value to fake.\nfunction test.Fake(value) end\n\n`,
317+
output: `---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Just for testing.\n---\n---[(View on wiki)](na)\n---@param value string|number The value to fake.\nfunction test.Fake(value) end\n\n`,
318318
},
319319
// Case with pipes and table<x> conversion
320320
{
@@ -330,7 +330,7 @@ describe('GLua API Writer', () => {
330330
}
331331
],
332332
},
333-
output: `---[SHARED] Just for testing.\n---\n---[(View on wiki)](na)\n---@param value string|table<number,Player> The value to fake.\nfunction test.Fake(value) end\n\n`,
333+
output: `---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Just for testing.\n---\n---[(View on wiki)](na)\n---@param value string|table<number,Player> The value to fake.\nfunction test.Fake(value) end\n\n`,
334334
},
335335
// Case with table<x> conversion in both altType and type
336336
{
@@ -347,7 +347,7 @@ describe('GLua API Writer', () => {
347347
}
348348
],
349349
},
350-
output: `---[SHARED] Just for testing.\n---\n---[(View on wiki)](na)\n---@param value table<number,Player>|table<Entity,number> The value to fake.\nfunction test.Fake(value) end\n\n`,
350+
output: `---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Just for testing.\n---\n---[(View on wiki)](na)\n---@param value table<number,Player>|table<Entity,number> The value to fake.\nfunction test.Fake(value) end\n\n`,
351351
},
352352
])('should handle alternate types correctly', async ({ api, output }) => {
353353
const writer = new GluaApiWriter();
@@ -372,7 +372,7 @@ describe('GLua API Writer', () => {
372372
],
373373
});
374374

375-
expect(api).toEqual(`---[SHARED] Just for testing.\n---\n---[(View on wiki)](na)\n---@param value table<string|number>|string The value to fake.\nfunction test.Fake(value) end\n\n`);
375+
expect(api).toEqual(`---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Just for testing.\n---\n---[(View on wiki)](na)\n---@param value table<string|number>|string The value to fake.\nfunction test.Fake(value) end\n\n`);
376376
});
377377

378378
it('should support structure table type', () => {
@@ -394,7 +394,7 @@ describe('GLua API Writer', () => {
394394
],
395395
});
396396

397-
expect(api).toEqual(`---[CLIENT] Returns where on the screen the specified position vector would appear.\n---\n---[(View on wiki)](na)\n---@return ToScreenData # The created Structures/ToScreenData.\nfunction Vector.ToScreen() end\n\n`);
397+
expect(api).toEqual(`---![(Client)](https://github.com/user-attachments/assets/a5f6ba64-374d-42f0-b2f4-50e5c964e808) Returns where on the screen the specified position vector would appear.\n---\n---[(View on wiki)](na)\n---@return ToScreenData # The created Structures/ToScreenData.\nfunction Vector.ToScreen() end\n\n`);
398398
});
399399

400400
// number{ENUM_NAME} -> ENUM_NAME
@@ -420,7 +420,7 @@ describe('GLua API Writer', () => {
420420
],
421421
});
422422

423-
expect(api).toEqual(`---[CLIENT] Sets the fog mode.\n---\n---[(View on wiki)](na)\n---@param mode MATERIAL_FOG The fog mode.\nfunction render.FogMode(mode) end\n\n`);
423+
expect(api).toEqual(`---![(Client)](https://github.com/user-attachments/assets/a5f6ba64-374d-42f0-b2f4-50e5c964e808) Sets the fog mode.\n---\n---[(View on wiki)](na)\n---@param mode MATERIAL_FOG The fog mode.\nfunction render.FogMode(mode) end\n\n`);
424424
});
425425

426426
// it('should be able to write Annotated API files directly from wiki pages', async () => {
@@ -486,7 +486,7 @@ describe('GLua API Writer', () => {
486486
// const writer = new GluaApiWriter();
487487
// const api = writer.writePage(mockWikiPage);
488488

489-
// expect(api).toEqual(`---[SHARED] Checks if the given object is valid.\n` +
489+
// expect(api).toEqual(`---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Checks if the given object is valid.\n` +
490490
// `---@param obj any The object to check.\n` +
491491
// `---@return boolean If the object is valid.\n` +
492492
// `function IsValid(obj) end\n\n`);
@@ -517,7 +517,7 @@ describe('GLua API Writer', () => {
517517
// const api = writer.writePage(mockWikiPage);
518518

519519
// expect(api).toEqual(`ai = {}\n\n` +
520-
// `---[SERVER] Translates a schedule name to its corresponding ID.\n` +
520+
// `---![(Server)](https://github.com/user-attachments/assets/d8fbe13a-6305-4e16-8698-5be874721ca1) Translates a schedule name to its corresponding ID.\n` +
521521
// `---@param sched string Then schedule name. In most cases, this will be the same as the Enums/SCHED name.\n` +
522522
// `---@return number The schedule ID, see Enums/SCHED. Returns -1 if the schedule name isn't valid.\n` +
523523
// `function ai.GetScheduleID(sched) end\n\n`);
@@ -548,7 +548,7 @@ describe('GLua API Writer', () => {
548548
// const api = writer.writePage(mockWikiPage);
549549

550550
// expect(api).toEqual(`surface = {}\n\n` +
551-
// `---[CLIENT] Returns the texture id of the material with the given name/path, for use with surface.SetTexture.\n` +
551+
// `---![(Client)](https://github.com/user-attachments/assets/a5f6ba64-374d-42f0-b2f4-50e5c964e808) Returns the texture id of the material with the given name/path, for use with surface.SetTexture.\n` +
552552
// `---@param nameOrPath string Name or path of the texture.\n` +
553553
// `---@return number The texture ID\n` +
554554
// `function surface.GetTextureID(nameOrPath) end\n\n`);
@@ -601,7 +601,7 @@ describe('GLua API Writer', () => {
601601

602602
// expect(api).toEqual(`---@class ControlPanel\n` +
603603
// `local ControlPanel = {}\n\n` +
604-
// `---[CLIENT] Creates a MatSelect panel and adds it as an item.\n` +
604+
// `---![(Client)](https://github.com/user-attachments/assets/a5f6ba64-374d-42f0-b2f4-50e5c964e808) Creates a MatSelect panel and adds it as an item.\n` +
605605
// `---@param convar string Calls MatSelect:SetConVar with this value.\n` +
606606
// `---@param options table If specified, calls MatSelect:AddMaterial(key, value) for each table entry. If the table key is a number, the function will instead be called with the value as both arguments.\n` +
607607
// `---@param autostretch boolean If specified, calls MatSelect:SetAutoHeight with this value.\n` +
@@ -672,7 +672,7 @@ describe('GLua API Writer', () => {
672672

673673
// expect(api).toEqual(`---@class CMoveData\n` +
674674
// `local CMoveData = {}\n\n` +
675-
// `---[SHARED] Sets the player movement constraint speed scale. This will be applied to the player within the constraint radius when approaching its edge.\n` +
675+
// `---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) Sets the player movement constraint speed scale. This will be applied to the player within the constraint radius when approaching its edge.\n` +
676676
// `---@param number number The constraint speed scale\n` +
677677
// `function CMoveData:SetConstraintSpeedScale(number) end\n\n`);
678678

@@ -720,7 +720,7 @@ describe('GLua API Writer', () => {
720720
// const writer = new GluaApiWriter();
721721
// const api = writer.writePage(mockWikiPage);
722722

723-
// expect(api).toEqual(`---[SHARED] If the result of the first argument is false or nil, an error is thrown with the second argument as the message.\n` +
723+
// expect(api).toEqual(`---![(Shared)](https://github.com/user-attachments/assets/a356f942-57d7-4915-a8cc-559870a980fc) If the result of the first argument is false or nil, an error is thrown with the second argument as the message.\n` +
724724
// `---@param expression any The expression to assert.\n` +
725725
// `---@param errorMessage string The error message to throw when assertion fails. This is only type-checked if the assertion fails.\n` +
726726
// `---@param ... ... Any arguments past the error message will be returned by a successful assert.\n` +

__tests__/test-data/offline-sites/gmod-wiki/hook-player-initial-spawn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ end )
148148
export const apiDefinition = `---@class GM
149149
GM = {}
150150
151-
---[SERVER] Called when the player spawns for the first time.
151+
---![(Server)](https://github.com/user-attachments/assets/d8fbe13a-6305-4e16-8698-5be874721ca1) Called when the player spawns for the first time.
152152
---
153153
--- See [GM:PlayerSpawn](https://wiki.facepunch.com/gmod/GM:PlayerSpawn) for a hook called every player spawn.
154154
---

__tests__/test-data/offline-sites/gmod-wiki/library-function-concommand-gettable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const apiDefinition =
1313
`--- Missing description.
1414
concommand = {}
1515
16-
---[SHARED AND MENU] Returns the tables of all console command callbacks, and autocomplete functions, that were added to the game with [concommand.Add](https://wiki.facepunch.com/gmod/concommand.Add).
16+
---![(Shared and Menu)](https://github.com/user-attachments/assets/8f5230ff-38f7-493b-b9fc-cc70ffd5b3f4) Returns the tables of all console command callbacks, and autocomplete functions, that were added to the game with [concommand.Add](https://wiki.facepunch.com/gmod/concommand.Add).
1717
---
1818
---[(View on wiki)](https://wiki.facepunch.com/gmod/concommand.GetTable)
1919
---@return table # Table of command callback functions.

__tests__/test-data/offline-sites/gmod-wiki/library-function-coroutine-resume.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const apiDefinition =
1515
`--- Missing description.
1616
coroutine = {}
1717
18-
---[SHARED AND MENU] Resumes the given coroutine and passes the given vararg to either the function arguments or the [coroutine.yield](https://wiki.facepunch.com/gmod/coroutine.yield) that is inside that function and returns whatever yield is called with the next time or by the final return in the function.
18+
---![(Shared and Menu)](https://github.com/user-attachments/assets/8f5230ff-38f7-493b-b9fc-cc70ffd5b3f4) Resumes the given coroutine and passes the given vararg to either the function arguments or the [coroutine.yield](https://wiki.facepunch.com/gmod/coroutine.yield) that is inside that function and returns whatever yield is called with the next time or by the final return in the function.
1919
---
2020
---[(View on wiki)](https://wiki.facepunch.com/gmod/coroutine.resume)
2121
---@param coroutine thread Coroutine to resume.

custom/DMenu.AddOption.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---[CLIENT] Add an option to the DMenu
1+
---![(Client)](https://github.com/user-attachments/assets/a5f6ba64-374d-42f0-b2f4-50e5c964e808) Add an option to the DMenu
22
---
33
---[(View on wiki)](https://wiki.facepunch.com/gmod/DMenu:AddOption)
44
---@param name string Name of the option.

custom/DMenu.AddPanel.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---[CLIENT] Adds a panel to the DMenu as if it were an option.
1+
---![(Client)](https://github.com/user-attachments/assets/a5f6ba64-374d-42f0-b2f4-50e5c964e808) Adds a panel to the DMenu as if it were an option.
22
---
33
--- This invokes DScrollPanel:AddItem and will not create a new panel if a class name is passed, unlike Panel:Add.
44
---

custom/DMenu.AddSubMenu.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---[CLIENT] Add a sub menu to the DMenu
1+
---![(Client)](https://github.com/user-attachments/assets/a5f6ba64-374d-42f0-b2f4-50e5c964e808) Add a sub menu to the DMenu
22
---
33
---[(View on wiki)](https://wiki.facepunch.com/gmod/DMenu:AddSubMenu)
44
---@param Name string Name of the sub menu.

custom/Global.DermaMenu.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---[CLIENT AND MENU] Creates a DMenu and closes any current menus.
1+
---![(Client and menu)](https://github.com/user-attachments/assets/25d1a1c8-4288-4a51-9867-5e3bb51b9981) Creates a DMenu and closes any current menus.
22
---
33
---[(View on wiki)](https://wiki.facepunch.com/gmod/Global.DermaMenu)
44
---@param keepOpen? boolean If we should keep other DMenus open (`true`) or not (`false`).

custom/Panel.Add.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---[CLIENT AND MENU] Adds the specified object to the panel.
1+
---![(Client and menu)](https://github.com/user-attachments/assets/25d1a1c8-4288-4a51-9867-5e3bb51b9981) Adds the specified object to the panel.
22
---
33
---[(View on wiki)](https://wiki.facepunch.com/gmod/Panel:Add)
44
---@generic T : Panel

custom/spawnmenu.AddCreationTab.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---[CLIENT] Inserts a new tab into the CreationMenus table, which will be used by the creation menu to generate its tabs (Spawnlists, Weapons, Entities, etc.)
1+
---![(Client)](https://github.com/user-attachments/assets/a5f6ba64-374d-42f0-b2f4-50e5c964e808) Inserts a new tab into the CreationMenus table, which will be used by the creation menu to generate its tabs (Spawnlists, Weapons, Entities, etc.)
22
---
33
---[(View on wiki)](https://wiki.facepunch.com/gmod/spawnmenu.AddCreationTab)
44
---@generic T : Panel

0 commit comments

Comments
 (0)