Template:Scribunto/doc

Revision as of 17:12, 25 August 2020 by imported>Davidwr (→‎See also: +*{{t|{{BASEPAGENAME}}/helper}} and {{t|{{BASEPAGENAME}}/helper2}}, two helper templates. These should not be called directly.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Usage

This helps with the creation of doc pages for Lua metamodules that reference the Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value). or specific function within it.

{{scribunto
|<!--anchor-->
|<!--link text-->
}}

If an anchor is provided, the link will be wrapped in ‎<code>...‎</code>. For example:

{{scribunto|mw.html.create}}

produces this link: Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value).

{{scribunto|HTML_library|mw.html}}

produces this link: Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value).

Advanced

|self= and |args=

See also: {{Luaself}}

You may also use |self={{PAGENAME}} to reference your own functions and |args= to specify args, like so:

{{scribunto|self=Buffer/doc|:_all|args=...}}

produces this link: Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value).

If the first char Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value). the pattern ^[:%.] then title specified by |self= will be inserted in front, minus any subpages, unless Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value).d with the \ char:

{{scribunto|self=Example\/testcases/doc|.test1|args=string}}

produces: Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value).

no 'main'

If your module has no "main" method (e.g. Module:Buffer), you can pass the escape char \ as the first char in the function name to make a self-reference:

{{scribunto|self=Buffer/doc|\|args=...}}

produces: Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value).' If the second parameter contains ***, then the first param will be substituted (or the self-reference, as applicable):

{{scribunto|self=Buffer|\|require('Module:***')|args=...}}

Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value).

|args2= and |args3=

Use to specify up to 3 argument variations.

{{scribunto|table.insert|args=table, value|args2=table, pos, value}}

Lua error in Module:Escape at line 24: attempt to call method 'gfind' (a nil value).

|plain=

If set to anything, the result will no longer be wrapped in ‎<code>...‎</code>.

See also