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

From blackwiki
Jump to navigation Jump to search
test>Primefac
(TFD closed as no consensus (XFDcloser))
test>WOSlinker
m (change source to syntaxhighlight)
Line 10: Line 10:
 
Load the module:
 
Load the module:
  
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
local mMainList = require('Module:Main list')
 
local mMainList = require('Module:Main list')
</source>
+
</syntaxhighlight>
  
 
You can then use the _mainList function like this:
 
You can then use the _mainList function like this:
  
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
mMainList._mainList (page1, page2)
 
mMainList._mainList (page1, page2)
</source>
+
</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>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''.
Line 25: Line 25:
  
 
=== Example 1 ===
 
=== Example 1 ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates')
 
mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates')
</source>
+
</syntaxhighlight>
 
Produces:
 
Produces:
 
:<code><nowiki><div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]].</div></nowiki></code>
 
:<code><nowiki><div class="hatnote">For a more comprehensive list, see [[Wikipedia:Hatnote#Hatnote templates|Wikipedia:Hatnote § Hatnote templates]].</div></nowiki></code>
Line 34: Line 34:
  
 
=== Example 2 ===
 
=== Example 2 ===
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates','Wikipedia:Template messages/Cleanup#Cleanup')
 
mMainList._mainList ('Wikipedia:Hatnote#Hatnote templates','Wikipedia:Template messages/Cleanup#Cleanup')
</source>
+
</syntaxhighlight>
 
Produces:
 
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>
 
:<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>

Revision as of 16:26, 7 July 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.