Module:Yesno/doc: Difference between revisions
Appearance
Content deleted Content added
Removed page from translation |
Prepared the page for translation |
||
| Line 1: | Line 1: | ||
<languages/> |
|||
<translate> |
|||
<noinclude><!-- |
<noinclude><!-- |
||
-->{{#ifeq:{{SUBPAGENAME}}|doc||{{Documentation subpage}}}}<!-- |
-->{{#ifeq:{{SUBPAGENAME}}|doc||{{Documentation subpage}}}}<!-- |
||
| Line 4: | Line 6: | ||
--></noinclude>{{#switch: |
--></noinclude>{{#switch: |
||
| = |
| = |
||
<includeonly> |
<includeonly></includeonly> |
||
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> |
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> |
||
</translate> |
|||
{{high-risk}} |
{{high-risk}} |
||
{{used in system}} |
{{used in system}} |
||
{{Module rating|release}} |
{{Module rating|release}} |
||
{{Module rating|protected}} |
{{Module rating|protected}} |
||
<translate> |
|||
This module provides a consistent interface for processing boolean or boolean-style string input. |
This module provides a consistent interface for processing boolean or boolean-style string input. |
||
While Lua allows the <code>true</code> and <code>false</code> boolean values, wikicode templates can only express boolean values through strings such as "1", "0", "yes", "no", etc. |
While Lua allows the <code>true</code> and <code>false</code> boolean values, wikicode templates can only express boolean values through strings such as "1", "0", "yes", "no", etc. |
||
| Line 16: | Line 20: | ||
The module also accepts other Lua structures as input, i.e. booleans, numbers, tables, and functions. |
The module also accepts other Lua structures as input, i.e. booleans, numbers, tables, and functions. |
||
If it is passed input that it does not recognise as boolean or <code>nil</code>, it is possible to specify a default value to return. |
If it is passed input that it does not recognise as boolean or <code>nil</code>, it is possible to specify a default value to return. |
||
== Module Quality == |
== Module Quality == |
||
</translate> |
|||
{{ModuleQuality}} |
{{ModuleQuality}} |
||
<translate> |
|||
== Syntax == |
== Syntax == |
||
<syntaxhighlight lang="lua"> |
<syntaxhighlight lang="lua"> |
||
yesno(value, default) |
yesno(value, default) |
||
| Line 26: | Line 36: | ||
Boolean input or boolean-style input (see below) always evaluates to either <code>true</code> or <code>false</code>, and <code>nil</code> always evaluates to <code>nil</code>. |
Boolean input or boolean-style input (see below) always evaluates to either <code>true</code> or <code>false</code>, and <code>nil</code> always evaluates to <code>nil</code>. |
||
Other values evaluate to <code>default</code>. |
Other values evaluate to <code>default</code>. |
||
== Usage == |
== Usage == |
||
First, load the module. Note that it can only be loaded from other Lua modules, not from normal wiki pages. |
First, load the module. Note that it can only be loaded from other Lua modules, not from normal wiki pages. |
||
For normal wiki pages you can use {{tlx|yesno}} instead. |
For normal wiki pages you can use {{tlx|yesno}} instead. |
||
| Line 110: | Line 122: | ||
<includeonly>{{Sandbox other|| |
<includeonly>{{Sandbox other|| |
||
<!-- Categories below this line; interwikis at Wikidata --> |
<!-- Categories below this line; interwikis at Wikidata --> |
||
</translate> |
|||
[[Category:Modules]] |
[[Category:Modules]] |
||
}}</includeonly><noinclude> |
}}</includeonly><noinclude> |
||
[[Category:Module documentation pages{{#translation:}}]] |
[[Category:Module documentation pages{{#translation:}}{{#translation:}}]] |
||
<translate> |
|||
</noinclude> |
</noinclude> |
||
| #default= |
| #default= |
||
{{#invoke:Template translation|renderTranslatedTemplate|template=Module:Yesno/doc|noshift=1|uselang={{int:lang}}}} |
{{#invoke:Template translation|renderTranslatedTemplate|template=Module:Yesno/doc|noshift=1|uselang={{int:lang}}}} |
||
}} |
}} |
||
</translate> |
|||