Module:Userbox/doc: Difference between revisions
Appearance
From Wikipedia, the free encyclopedia
m update transclusion count
→Tracking categories: a tracking category has been renamed per Wikipedia:Categories_for_discussion/Log/2021_January_19#Category:Pages_with_misplaced_templates
(8 intermediate revisions by 6 users not shown)
Line 1:
Line 1:
{{(削除) high (削除ここまで)-(削除) risk (削除ここまで)|(削除) 190,000+ (削除ここまで)}}
{{(追記) High (追記ここまで)-(追記) use (追記ここまで)|(追記) 233415 (追記ここまで)}}
{{Lua|Module:Category handler|Module:Arguments|Module:Color contrast}}
This module does the processing for three userbox templates, {{tl|userbox}}, {{tl|userbox-2}} and {{tl|userbox-r}}.
This module does the processing for three userbox templates, {{tl|userbox}}, {{tl|userbox-2}} and {{tl|userbox-r}}.
Line 30:
Line 31:
To generate a userbox directly from Lua, first load the module.
To generate a userbox directly from Lua, first load the module.
<(削除) source (削除ここまで) lang="lua">
<(追記) syntaxhighlight (追記ここまで) lang="lua">
local userbox = require('Module:Userbox')
local userbox = require('Module:Userbox')
</syntaxhighlight>
</source>
You can then run any of the three templates with the code:
You can then run any of the three templates with the code:
<(削除) source (削除ここまで) lang="lua">
<(追記) syntaxhighlight (追記ここまで) lang="lua">
userbox.main(functionName, args)
userbox.main(functionName, args)
</syntaxhighlight>
</source>
For {{tl|userbox}} use the function name "<code>_userbox</code>"; for {{tl|userbox-2}} use the function name "<code>_userbox-2</code>"; and for {{tl|userbox-r}} use the function name "<code>_userbox-r</code>". The <code>args</code> parameter is a table of arguments to pass to the different userbox functions. To see a list of valid arguments, please consult the individual template pages.
For {{tl|userbox}} use the function name "<code>_userbox</code>"; for {{tl|userbox-2}} use the function name "<code>_userbox-2</code>"; and for {{tl|userbox-r}} use the function name "<code>_userbox-r</code>". The <code>args</code> parameter is a table of arguments to pass to the different userbox functions. To see a list of valid arguments, please consult the individual template pages.
== Tracking categories ==
* {{clc|Userboxes with insufficient color contrast}}
* {{clc|Pages with templates in the wrong namespace}}
Latest revision as of 02:29, 31 January 2021
Warning This Lua module is used on approximately 337,000 pages .
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
To avoid major disruption and server load, any changes should be tested in the module's /sandbox or /testcases subpages, or in your own module sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
This module depends on the following other modules:
This module does the processing for three userbox templates, {{userbox }}, {{userbox-2 }} and {{userbox-r }}.
| Template | Description | Examples |
|---|---|---|
| {{userbox }} | Makes userboxes with an id on the left-hand side, or with no id. | id {{{info}}}{{{info}}} |
| {{userbox-2 }} | Makes userboxes with an id on both the left- and right-hand sides. | id1 {{{info}}} id2 |
| {{userbox-r }} | Makes userboxes with an id on the right-hand side. | {{{info}}} id |
To use any of these templates from a wiki page, please see the individual template pages for documentation. To generate userboxes directly from Lua, read on.
Generating userboxes from Lua
[edit ]To generate a userbox directly from Lua, first load the module.
localuserbox=require('Module:Userbox')
You can then run any of the three templates with the code:
userbox.main(functionName,args)
For {{userbox }} use the function name "_userbox"; for {{userbox-2 }} use the function name "_userbox-2"; and for {{userbox-r }} use the function name "_userbox-r". The args parameter is a table of arguments to pass to the different userbox functions. To see a list of valid arguments, please consult the individual template pages.