Module:Main list
Sarna News

- Bad 'Mechs - Thresher Mk II
- HEXTECH Wave 9 Review - Winding Rivers, Tall Walls, and Underground Tunnels
- Hired Steel and Making MechWarrior 5: Clans Cinematics with Constantin & Bernhard of TMC
- Your BattleTech News Round-Up For December, 2024
- Community Outreach - Caterwauling On CamoSpecs With Matt "00Dawg" Frederiksen
- Read more →
This module produces a "For a more comprehensive list, see [...]" link. It implements the {{main list}} template.
Contents
Use from wikitext[edit]
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[edit]
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[edit]
mMainList._mainList ('BattleTechWiki:Hatnote#Hatnote templates')
Produces:
<div class="hatnote">For a more comprehensive list, see [[BattleTechWiki:Hatnote#Hatnote templates|BattleTechWiki:Hatnote § Hatnote templates]].</div>
Displays as:
Example 2[edit]
mMainList._mainList ('BattleTechWiki:Hatnote#Hatnote templates','BattleTechWiki:Template messages/Cleanup#Cleanup')
Produces:
<div class="hatnote">For a more comprehensive list, see [[BattleTechWiki:Hatnote#Hatnote templates|BattleTechWiki:Hatnote § Hatnote templates]] and [[BattleTechWiki:Template index/Cleanup#Cleanup|BattleTechWiki:Template messages/Cleanup § Cleanup]].</div>
Displays as:
Technical details[edit]
This module uses Module:Hatnote to format the hatnote text and Module:Arguments to fetch the arguments from wikitext.
--[[
-- This module produces a "For more details on this topic" link. It implements
-- the {{Main list}} template.
--]]
local mHatnote = require('Module:Hatnote')
local mHatlist = require('Module:Hatnote list')
local mArguments -- lazily initialise
local mTableTools -- lazily initialise
local p = {}
function p.mainList(frame)
mArguments = require('Module:Arguments')
mTableTools = require('Module:TableTools')
local args = mArguments.getArgs(frame, {parentOnly = true})
if not args[1] then
return mHatnote.makeWikitextError(
'no page name specified',
'Template:Main list#Errors',
args.category
)
end
return p._mainList(mTableTools.compressSparseArray(args))
end
function p._mainList(args)
local pages = mHatlist.andList(args, true)
local text = string.format('For a more comprehensive list, see %s.', pages)
return mHatnote._hatnote(text)
end
return p