Template:Scribunto/doc: Difference between revisions
More actions
Created page with "<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see Wikipedia:Wikidata) --> == Usage == This helps with the creation of doc pages for Lua metamodules that reference the {{Scribunto}} or specific function within it. <pre> {{scribunto |<!--anchor--> |<!--link text--> }} </pre> If an anchor is provided, the link will be wrapped in {{tag|code}}. For example:{{demo|<nowiki>{{scribunto|mw.html.create}}</nowiki>|br=produ..." |
No edit summary |
||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | |||
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> | <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> | ||
== Usage == | == Usage == | ||
Latest revision as of 02:03, 17 February 2025
| This is a documentation subpage for Template:Scribunto. It may contain usage information, categories and other content that is not part of the original template page. |
Usage
This helps with the creation of doc pages for Lua metamodules that reference the Scribunto manual 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:
mw.html.create
{{scribunto|HTML_library|mw.html}}produces this link: mw.html
Advanced
|self= and |args=
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:
Buffer:_all
( ... )
If the first char matches the pattern ^[:%.] then title specified by |self= will be inserted in front, minus any subpages, unless
escaped with the \ char:
{{scribunto|self=Example\/testcases/doc|.test1|args=string}}produces:
Example/testcases.test1
( string )
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:
Buffer'
If the second parameter contains ( ... )
***, then the first param will be substituted (or the self-reference, as applicable):
{{scribunto|self=Buffer|\|require('Module:***')|args=...}}require('Module:Buffer')( ... )
|args2= and |args3=
Use to specify up to 3 argument variations.
{{scribunto|table.insert|args=table, value|args2=table, pos, value}}
table.insert
( table, pos, value )
|plain=
If set to anything, the result will no longer be wrapped in <code>...</code>.
See also
- {{Scribunto/helper}} and {{Scribunto/helper2}}, two helper templates. These should not be called directly.
- {{Luaself}}, a wrapper template that makes Lua self-references easier.
- Module:Buffer/doc, an example of a doc that uses this
- {{Lua}}
- Category:Lua metamodules