Changes
Removed extraclasses option; those classes appear to be deprecated
local mHatnote = require('Module:Hatnote')
local mTableTools -- lazily initialisemHatlist = require('Module:Hatnote list')
local mArguments -- lazily initialise
local p = {}
function p.main(frame)
mArguments = require('Module:Arguments')
local args = mArguments.getArgs(frame, {parentOnly = true})
for k, v in pairs(args) do
if type(k) == 'number' then
local display = args['label ' .. k] or args['l' .. tostring(k)] local page = {display and string.format('%s|%s', string.gsub(v, '|.*$', ''), display}) or v pages[k#pages + 1] = page
end
end
if #pages = mTableTools= 0 and mw.title.getCurrentTitle().compressSparseArraynamespace == 0 then return mHatnote.makeWikitextError(pages 'no page names specified', 'Template:Main#Errors', args.category ) end
local options = {
selfref = args.selfref
}
return p._main(pages, options, unpack(pages))
end
function p._main(args, options, ...)
-- Get the list of pages. If no first page was specified we use the current
-- page name.
local currentTitle = mw.title.getCurrentTitle()
-- Find the pagetype.
local firstPageNs pageType = mHatnote.findNamespaceId(firstPage) local pagetype = firstPageNs == 0 and 'article' or 'page'
-- Make the formatted link text
-- Build the text.
local isPlural = #pages args > 1 local currentNs mainForm local curNs = currentTitle.namespace local isCategoryNamespace if (curNs == currentNs - currentNs % 2 14) or (curNs == 14 local stringToFormat if isCategoryNamespace 15) then--category/talk namespaces if mainForm = isPlural thenand stringToFormat = 'The main %ss for this' .. ' [[Wikipedia:Categorization|category]] are %s' else or stringToFormat = 'The main %s for this' .. ' [[Wikipedia:Categorization|category]] is %s' end
else
end
local text = string.format(stringToFormatmainForm, pagetypepageType, linkslist)
-- Process the options and pass the text to the _rellink function in
-- [[Module:Hatnote]].
options = options or {}
local hnOptions = {
selfref = options.selfref
}