require('strict')local mHatnote = require('Module:Hatnote')local mTableTools -- lazily initialiselocal mArguments -- lazily initialise
local p =
function p.main(frame) mTableTools = require('Module:TableTools') mArguments = require('Module:Arguments') local args = mArguments.getArgs(frame,) local pages = for k, v in pairs(args) do if type(k)
function p._main(options, ...) -- Get the list of pages. If no first page was specified we use the current -- page name. local pages = local currentTitle = mw.title.getCurrentTitle local firstPageTable = pages[1] local firstPage if firstPageTable then firstPage = firstPageTable[1] else firstPage = currentTitle.text firstPageTable = pages[1] = firstPageTable end
-- Find the pagetype. local firstPageNs = mHatnote.findNamespaceId(firstPage) local pagetype = firstPageNs
-- Make the formatted link text local links = mHatnote.formatPageTables(unpack(pages)) links = mw.text.listToText(links)
-- Build the text. local isPlural = #pages > 1 local currentNs = currentTitle.namespace local isCategoryNamespace = currentNs - currentNs % 2
-- Process the options and pass the text to the _rellink function in -- . options = options or local hnOptions = return mHatnote._hatnote(text, hnOptions)end
return p