Changes
format p._main to accept a list of page/display tables as input
-- Produces a link to a main article or articles. If used in category or
-- category talk space, produces "The main article for this category is xxx".
-- Otherwise, produces "Main article: xxx". Accepts a an unlimited number of-- page/display tables. Non-table of argumentsinputs will result in an error.The first-- Numerical keys for this value in the table are should be the page namesname. If Omitting this will result in an-- error, except in the case of the first table, which uses the page name as a-- fallaback. The second value in the table isan optional display value for-- the link. If the first page name is not in mainspace, the output uses "page" -- instead of "article". If more than one page is-- specified, the function uses plural forms. Display names can be specified for-- each page name by using the arguments l1, l2, etcplural forms.
--------------------------------------------------------------------------------
function p._main(args...) -- Initialize variablesGet the list of pages. If no first page was specified we use the current -- page name. local links, firstPagepages = {...}
local currentTitle = mw.title.getCurrentTitle()
else
firstPage = currentTitle.text
end
-- Make the list of formatted links local links = {} for i, num t in ipairs(numspages) do local link = argst[num1] local display = argst['l' .. tostring(num)2]
links[#links + 1] = formatLink(link, display)
end
end
function f.main(args) local pages = {} for k, v in pairs(args) do if type(k) == 'number' then local display = args['l' .. tostring(k)] local page = {v, display} pages[k] = page end end pages = mTableTools.compressSparseArray(pages) return p._main(unpack(pages))end p.main = makeInvokeFunction(pf._mainmain)
return p