Difference between revisions of "Template:Lua/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>Sardanaphalus
(handling no, one, two, more-than-two parameters)
imported>Andrybak
m (clean up)
 
(20 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Mbox
+
<includeonly>{{#invoke:Lua banner/sandbox|main}}</includeonly><noinclude>
| type = notice
+
{{documentation}}
| small = yes
+
<!-- Categories go on the /doc subpage and interwikis go on Wikidata. -->
| image = [[File:Lua-logo-nolabel.svg|30px|alt=Lua logo|link=Wikipedia:Lua]]
 
| text = Uses
 
  {{#if:{{{1|}}}
 
    | the [[Wikipedia:Lua|Lua]] module<!--              <!--(At least one parameter supplied)
 
      -->{{#if:{{{2|}}}
 
          |s {{hlist |item_style=font-style:italic;    <!--(At least two parameters supplied)
 
            -->| [[:{{{1}}}|{{str right|{{{1}}}|7}}<!--(i.e. omit initial "Module:" (7 chars) from link's label)-->]]
 
              | [[:{{{2}}}|{{str right|{{{2}}}|7}}]]
 
              | {{#if:{{{3|}}} |[[:{{{3}}}|{{str right|{{{3}}}|7}}]]}}
 
              | {{#if:{{{4|}}} |[[:{{{4}}}|{{str right|{{{4}}}|7}}]]}}
 
              | {{#if:{{{5|}}} |[[:{{{5}}}|{{str right|{{{5}}}|7}}]]}}
 
              }}
 
          | ''[[:{{{1}}}|{{str right|{{{1}}}|7}}]]''.  <!--(Only one parameter supplied)
 
      -->}}
 
    | [[Wikipedia:Lua|Lua]].<!--                        <!--(No parameters supplied)-->
 
}} }}<!--
 
 
 
----------------------------------------
 
Categorization
 
----------------------------------------
 
--><includeonly><!--
 
-->{{#ifeq:{{{nocat|}}}|true |<!--(no categorization)-->
 
    | {{Template other
 
      | {{#switch:{{SUBPAGENAME}} |doc|sandbox|sandbox2|testcases= <!--(don't categorize these subpages)-->
 
          | #default = <!--
 
          -->[[Category:{{#if:{{{category|}}} |{{{category}}}
 
                          | {{#switch:{{{1|}}}
 
                            | Module:String = Lua String-based templates
 
                            | Module:Math = Templates based on the Math Lua module
 
                            | Module:BaseConvert = Templates based on the BaseConvert Lua module
 
                            | Module:Citation |Module:Citation/CS1 = Lua-based citation templates
 
                            | #default = Lua-based templates
 
                            }} }}<!--
 
            -->|{{PAGENAME}}<!--(category index)
 
          -->]]<!--
 
-->}} }} }}<!--
 
-->{{#if:{{{2|}}}{{#if:{{{1|}}}||(first parameter absent)}} |[[Category:Lua templates with deprecated parameters]]}}<!--
 
--></includeonly><noinclude>
 
{{Documentation}}
 
 
</noinclude>
 
</noinclude>

Latest revision as of 12:26, 12 November 2020

Template documentation[view] [edit] [history] [purge]

This template is used to show that templates have been converted to Lua. It is placed at the top of the template's /doc page. It automatically adds the template to Category:Lua-based templates, or to one of its subcategories.

Usage

Basic 
{{Lua|module name}}
All parameters 
{{Lua|module 1|module 2|module 3|...|category=custom category|nocat=true}}

The first module name is required.

Examples

  • {{Lua|Module:Example}}
  • {{Lua|Module:Example|Module:Example}}

Categorisation

Template category

This template adds pages to Category:Lua-based templates if the page is in the template namespace, and it is not on any of the subpages /doc, /sandbox, /sandbox2 or /testcases. You can specify a different category with the |category= parameter, e.g. |category=Lua String-based templates.

Some modules have a default category other than Category:Lua-based templates:

Error category

If no modules are specified, the transcluded page will be added to Category:Lua templates with errors.

Category suppression

To suppress all categorisation, use |nocat=true. (As well as "true", the values "yes", "y", and "1" will also work.)

See also