Skip to content

Commit 9daa7e0

Browse files
docs(mods): generate API docs (#15)
Co-authored-by: haithium <128622475+haithium@users.noreply.github.com>
1 parent d8a3d29 commit 9daa7e0

7 files changed

Lines changed: 26 additions & 35 deletions

File tree

docs/src/mods/api/date.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,9 +568,9 @@ print(d:weekday(-7)) --> 2026-03-23 00:00:00
568568
```
569569

570570
The getter returns a number in the range `0..6`, relative to the current
571-
[`mods.calendar.firstweekday`](/modules/calendar#fn-firstweekday). Passing an
572-
integer returns a shifted copy in the same locale-relative week space, with
573-
negative and overflow values moving into previous or next weeks.
571+
`mods.calendar.firstweekday`. Passing an integer returns a shifted copy in the
572+
same locale-relative week space, with negative and overflow values moving into
573+
previous or next weeks.
574574

575575
<a id="fn-weeks-in-year"></a>
576576

@@ -876,8 +876,7 @@ Return `true` when the value is a duration created by `date.duration(...)`.
876876

877877
**Return**:
878878

879-
- `isDuration` (`boolean`): Whether the value is a
880-
[`mods.Duration`](/modules/duration).
879+
- `isDuration` (`boolean`): Whether the value is a `mods.Duration`.
881880

882881
**Example**:
883882

docs/src/mods/api/keyword.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ kw.isidentifier("hello_world") --> true
1919

2020
**Collections**:
2121

22-
| Function | Description |
23-
| ------------------------ | ------------------------------------------------------ |
24-
| [`kwlist()`](#fn-kwlist) | Return Lua keywords as a [`mods.List`](/modules/list). |
25-
| [`kwset()`](#fn-kwset) | Return Lua keywords as a [`mods.Set`](/modules/set). |
22+
| Function | Description |
23+
| ------------------------ | ------------------------------------- |
24+
| [`kwlist()`](#fn-kwlist) | Return Lua keywords as a `mods.List`. |
25+
| [`kwset()`](#fn-kwset) | Return Lua keywords as a `mods.Set`. |
2626

2727
**Normalization**:
2828

@@ -43,7 +43,7 @@ kw.isidentifier("hello_world") --> true
4343

4444
#### `kwlist()`
4545

46-
Return Lua keywords as a [`mods.List`](/modules/list).
46+
Return Lua keywords as a `mods.List`.
4747

4848
**Return**:
4949

@@ -60,7 +60,7 @@ kw.kwlist():contains("global") --> true -- Lua 5.5+
6060

6161
#### `kwset()`
6262

63-
Return Lua keywords as a [`mods.Set`](/modules/set).
63+
Return Lua keywords as a `mods.Set`.
6464

6565
**Return**:
6666

docs/src/mods/api/ntpath.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ print(ntpath.splitdrive([[C:\Users\me]])) --> "C:", [[\Users\me]]
1919
print(ntpath.isreserved([[C:\Temp\CON.txt]])) --> true
2020
```
2121

22-
> ✨ Same API as [`mods.path`](/modules/path), but with Windows/NT path
23-
> semantics.
22+
> ✨ Same API as `mods.path`, but with Windows/NT path semantics.
2423
2524
## Functions
2625

docs/src/mods/api/path.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -693,9 +693,8 @@ path.normcase("/A/B") --> "\\a\\b"
693693

694694
> [!NOTE]
695695
>
696-
> On POSIX semantics this returns the input unchanged. Use
697-
> [`mods.ntpath`](/modules/ntpath) to force Windows-style case folding and
698-
> separator normalization.
696+
> On POSIX semantics this returns the input unchanged. Use `mods.ntpath` to
697+
> force Windows-style case folding and separator normalization.
699698
700699
<a id="fn-normpath"></a>
701700

docs/src/mods/api/posixpath.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ print(posixpath.splitext("archive.tar.gz")) --> "archive.tar", ".gz"
1919
print(posixpath.relpath("/usr/local/bin", "/usr")) --> "local/bin"
2020
```
2121

22-
> ✨ Same API as [`mods.path`](/modules/path), but with POSIX path semantics.
22+
> ✨ Same API as `mods.path`, but with POSIX path semantics.

docs/src/mods/api/str.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ s = format_map("hi {name}", { name = "bob" }) --> "hi bob"
377377
> [!NOTE]
378378
>
379379
> `format_map` is a lightweight `{key}` replacement helper. For richer
380-
> templating, use [`mods.template`](/modules/template).
380+
> templating, use `mods.template`.
381381
382382
### Layout
383383

docs/src/mods/api/utils.md

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ print(utils.quote('hello "world"')) --> 'hello "world"'
3232

3333
**Validation**:
3434

35-
| Function | Description |
36-
| ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
37-
| [`assert_arg(argn, v, validator?, optional?, lv?)`](#fn-assert-arg) | Assert argument value using [`mods.validate`](/modules/validate) and raise a Lua error on failure. |
38-
| [`validate(name, v, validator?, optional?, msg?)`](#fn-validate) | Validate a value using [`mods.validate`](/modules/validate) and raise a Lua error on failure. |
39-
| [`validate(path, v, validator?, optional?, msg?)`](#fn-validate) | Validate a value using [`mods.validate`](/modules/validate) and raise a Lua error on failure. |
35+
| Function | Description |
36+
| ------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
37+
| [`assert_arg(argn, v, validator?, optional?, lv?)`](#fn-assert-arg) | Assert argument value using `mods.validate` and raise a Lua error on failure. |
38+
| [`validate(name, v, validator?, optional?, msg?)`](#fn-validate) | Validate a value using `mods.validate` and raise a Lua error on failure. |
39+
| [`validate(path, v, validator?, optional?, msg?)`](#fn-validate) | Validate a value using `mods.validate` and raise a Lua error on failure. |
4040

4141
### Formatting
4242

@@ -148,8 +148,7 @@ print(stringify({ a = 1 }))
148148

149149
#### `assert_arg(argn, v, validator?, optional?, lv?)`
150150

151-
Assert argument value using [`mods.validate`](/modules/validate) and raise a Lua
152-
error on failure.
151+
Assert argument value using `mods.validate` and raise a Lua error on failure.
153152

154153
**Parameters**:
155154

@@ -183,17 +182,15 @@ utils.assert_arg(3, "x", "number", false, "need {{expected}}, got {{got}}")
183182

184183
#### `validate(name, v, validator?, optional?, msg?)`
185184

186-
Validate a value using [`mods.validate`](/modules/validate) and raise a Lua
187-
error on failure.
185+
Validate a value using `mods.validate` and raise a Lua error on failure.
188186

189187
**Parameters**:
190188

191189
- `name` (`string`): Name for the error prefix.
192190
- `v` (`any`): Value to validate.
193191
- `validator?` (`modsValidatorName`): Validator name (defaults to `"truthy"`).
194192
- `optional?` (`boolean`): Skip errors when `v` is `nil` (defaults to `false`).
195-
- `msg?` (`string`): Optional override template passed to
196-
[`mods.validate`](/modules/validate).
193+
- `msg?` (`string`): Optional override template passed to `mods.validate`.
197194

198195
**Return**:
199196

@@ -212,17 +209,15 @@ utils.validate("count", "x", "number")
212209

213210
#### `validate(path, v, validator?, optional?, msg?)`
214211

215-
Validate a value using [`mods.validate`](/modules/validate) and raise a Lua
216-
error on failure.
212+
Validate a value using `mods.validate` and raise a Lua error on failure.
217213

218214
**Parameters**:
219215

220216
- `path` (`table`): Path parts for the error name.
221217
- `v` (`any`): Value to validate.
222218
- `validator?` (`modsValidatorName`): Validator name (defaults to `"truthy"`).
223219
- `optional?` (`boolean`): Skip errors when `v` is `nil` (defaults to `false`).
224-
- `msg?` (`string`): Optional override template passed to
225-
[`mods.validate`](/modules/validate).
220+
- `msg?` (`string`): Optional override template passed to `mods.validate`.
226221

227222
**Return**:
228223

@@ -238,5 +233,4 @@ utils.validate({ "ctx", "users", 1, "name" }, 123, "string")
238233

239234
> [!NOTE]
240235
>
241-
> On failure, `path` is rendered with
242-
> [`mods.utils.keypath`](/modules/utils#fn-keypath).
236+
> On failure, `path` is rendered with `mods.utils.keypath`.

0 commit comments

Comments
 (0)