Difference between revisions of "Template:Main list/doc"

From blackwiki
Jump to navigation Jump to search
imported>DePiep
(+standard documentation)
m (16 revisions imported)
 
(29 intermediate revisions by 20 users not shown)
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 ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
+
This module produces a "For a more comprehensive list, see [...]" link. It implements the {{tl|main list}} template.
  
== Usage ==
+
== Use from wikitext ==
To link to a "sub-list" on a topic, use:
 
:'''<code><nowiki>{{mainlist|the other list}}</nowiki></code>'''
 
  
{{Other uses templates documentation}}
+
This module cannot be used directly from #invoke. Instead, it can only be used through the {{tl|main list}} template. Please see the template page for documentation.
  
<includeonly>
+
== Use from other Lua modules ==
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
  
[[Category:Wikipedia page-section templates|{{PAGENAME}}]]
+
Load the module:
[[Category:List notification templates|{{PAGENAME}}]]
 
[[Category:Cross-reference templates|{{PAGENAME}}]]
 
[[Category:Hatnote templates]]
 
  
[[mk:Шаблон:Главен список]]
+
<syntaxhighlight lang="lua">
[[tr:Şablon:Analiste]]
+
local mMainList = require('Module:Main list')
</includeonly>
+
</syntaxhighlight>
 +
 
 +
You can then use the _mainList function like this:
 +
 
 +
<syntaxhighlight lang="lua">
 +
mMainList._mainList (page1, page2)
 +
</syntaxhighlight>
 +
 
 +
The <var>page1</var> variable is the page to be linked to, and is required. The page name can include a section link if desired. If the page includes a section link, it is automatically formatted as ''page § section'', rather than the MediaWiki default of ''page#section''.
 +
 
 +
The <var>page2</var> variable is optional; it is a second page link.
 +
 
 +
=== Example 1 ===
 +
<syntaxhighlight lang="lua">
 +
mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates')
 +
</syntaxhighlight>
 +
Produces:
 +
:<code><nowiki><div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]].</div></nowiki></code>
 +
Displays as:
 +
<div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]].</div>
 +
 
 +
=== Example 2 ===
 +
<syntaxhighlight lang="lua">
 +
mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates','Wikipedia:Template messages/Cleanup#Cleanup')
 +
</syntaxhighlight>
 +
Produces:
 +
:<code><nowiki><div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]] and [[Wikipedia:Template messages/Cleanup#Cleanup|Wikipedia:Template messages/Cleanup § Cleanup]].</div></nowiki></code>
 +
Displays as:
 +
<div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]] and [[Wikipedia:Template messages/Cleanup#Cleanup|Wikipedia:Template messages/Cleanup § Cleanup]].</div>
 +
 
 +
== Technical details ==
 +
 
 +
This module uses [[Module:Hatnote]] to format the hatnote text and [[Module:Arguments]] to fetch the arguments from wikitext.
 +
 
 +
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
 +
<!-- Categories go here and interwikis go in Wikidata. -->
 +
[[Category:Hatnote modules]]
 +
}}</includeonly>

Latest revision as of 10:26, 7 September 2020

This module produces a "For a more comprehensive list, see [...]" link. It implements the {{main list}} template.

Use from wikitext

This module cannot be used directly from #invoke. Instead, it can only be used through the {{main list}} template. Please see the template page for documentation.

Use from other Lua modules

Load the module:

local mMainList = require('Module:Main list')

You can then use the _mainList function like this:

mMainList._mainList (page1, page2)

The page1 variable is the page to be linked to, and is required. The page name can include a section link if desired. If the page includes a section link, it is automatically formatted as page § section, rather than the MediaWiki default of page#section.

The page2 variable is optional; it is a second page link.

Example 1

mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates')

Produces:

<div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]].</div>

Displays as:

For a more comprehensive list, see Wikipedia:Hatnote § Hatnote templates.

Example 2

mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates','Wikipedia:Template messages/Cleanup#Cleanup')

Produces:

<div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]] and [[Wikipedia:Template messages/Cleanup#Cleanup|Wikipedia:Template messages/Cleanup § Cleanup]].</div>

Displays as:

Technical details

This module uses Module:Hatnote to format the hatnote text and Module:Arguments to fetch the arguments from wikitext.