Jump to content

Module:TOCyears/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
m Pppery moved page Module:TOC/doc to Module:TOCyears/doc
Cleanup after deletion of Template:List TOC
Line 1: Line 1:
This module implements various [[WP:TOC|table of contents]] (TOC) templates. At the moment, it implements {{tl|TOCyears}}.
This module implements {{tl|TOCyears}}


== Usage ==
== Usage ==
=== Available functions ===

{| class="wikitable"
|-
! #invoke function
! Lua function
! Template
|-
| years
| _years
| {{tl|TOCyears}}
|-
| list
| _list
| unused
|}


=== From wikitext ===
=== From wikitext ===


From wikitext this module should usually be used through one of the templates in the table above. However, it is also possible to use it with the following syntax:
From wikitext this module should usually be used through {{tl|TOCyears}}. However, it is also possible to use it with the following syntax:


{{#invoke:TOC|''function''|''args''}}
{{#invoke:TOC|years|''args''}}

The function names are listed in the table in the "#invoke function" column, and <var>args</var> are the arguments that would normally be added by the template. Please see the template documentation for each template for available parameters.


See the documentation of {{tl|TOCyears}} for available parameters.
=== From Lua ===
=== From Lua ===


Line 32: Line 15:


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local mTOC = require('Module:TOC')
local mTOCyears = require('Module:TOCyears')
</syntaxhighlight>
</syntaxhighlight>


You can then use the functions with the following syntax:
You can then use it with the following syntax:


<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
mTOC.func(args)
mTOCyears._years(args)
</syntaxhighlight>
</syntaxhighlight>


"func" should be changed to one of the Lua function names in the table above. These all start with an underscore ("_"). The <var>args</var> variable is a table of arguments to be passed to the function. Please see the template documentation for available arguments.
<var>args</var> variable is a table of arguments to be passed to the function. Please see {{tl|TOCyears}} for available arguments.

<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- Categories go here and interwikis go in Wikidata. -->

}}</includeonly>

Revision as of 17:03, 4 October 2020

This module implements {{TOCyears}}

Usage

From wikitext

From wikitext this module should usually be used through {{TOCyears}}. However, it is also possible to use it with the following syntax:

{{#invoke:TOC|years|args}}

See the documentation of {{TOCyears}} for available parameters.

From Lua

Load the module like this:

local mTOCyears = require('Module:TOCyears')

You can then use it with the following syntax:

mTOCyears._years(args)

args variable is a table of arguments to be passed to the function. Please see {{TOCyears}} for available arguments.