Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 Use from wikitext  





2 Use from other Lua modules  



2.1  Example 1  





2.2  Example 2  







3 Technical details  














Module:Main list






العربية
تۆرکجه
فارسی
Fiji Hindi

Ilokano
Bahasa Indonesia
Kurdî
Ladin
Македонски



Simple English
Slovenščina
کوردی
Српски / srpski

اردو
Tiếng Vit

 

Edit links
 









Module
Talk
 

















Read
View source
View history
 








Tools
   


Actions  



Read
View source
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 





Permanently protected module

From Wikipedia, the free encyclopedia
 


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.

--[[
-- 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

Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Main_list&oldid=880025847"

Category: 
Hatnote modules
Hidden category: 
Wikipedia semi-protected modules
 



This page was last edited on 24 January 2019, at 21:24 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki