1,535
edits
(only load modules when necessary) |
m (16 revisions imported from templatewiki:Module:Main) |
||
(14 intermediate revisions by 5 users not shown) | |||
Line 9:
local mHatnote = require('Module:Hatnote')
local mArguments -- lazily initialise
local p = {}
function p.main(frame)
▲ mTableTools = require('Module:TableTools')
mArguments = require('Module:Arguments')
local args = mArguments.getArgs(frame, {parentOnly = true})
Line 21 ⟶ 19:
for k, v in pairs(args) do
if type(k) == 'number' then
local display = args['label ' .. k] or args['l' ..
local page =
string.format('%s|%s', string.gsub(v, '|.*$', ''), display) or v
pages[
end
end
if #pages == 0 and mw.title.getCurrentTitle().namespace == 0 then
return mHatnote.makeWikitextError(
return p._main(unpack(pages))▼
'no page names specified',
'Template:Main#Errors',
args.category
)
end▼
selfref = args.selfref
}
end
function p._main(
-- Get the list of pages. If no first page was specified we use the current
-- page name.
▲ local pages = {...}
local currentTitle = mw.title.getCurrentTitle()
if #args == 0 then args = {currentTitle.text} end
local firstPage = string.gsub(args[1], '|.*$', '')
firstPage = currentTitle.text▼
▲ end
-- Find the pagetype.
local
-- Make the formatted link text
list = mHatlist.andList(args, true)
-- Build the text.
local isPlural = #
local mainForm
if (curNs == 14) or (curNs == 15) then --category/talk namespaces
'The main %ss for this [[Help:Categories|category]] are %s'
▲ if isPlural then
or
else
end
local text = string.format(
-- Process the options and pass the text to the _rellink function in
-- [[Module:Hatnote]].
options = options or {}
local hnOptions = {
return mHatnote._rellink(text, extraclasses)▼
selfref = options.selfref
}
end
|