Changes

Jump to navigation Jump to search

Module:Hatnote

199 bytes added, 19:06, 15 April 2014
factor out some of the main code to a shared function
return ret
end
 local function formatPageTables(pages) -- Takes a list of page/display tables and returns it as a list of -- formatted links. Nil values are not allowed. local links = {} for i, t in ipairs(pages) do local link = t[1] local display = t[2] links[i] = formatLink(link, display) end return linksend
local function makeWikitextError(msg)
firstPageTable = {firstPage}
pages[1] = firstPageTable
end
 
-- Make the list of formatted links
local links = {}
for i, t in ipairs(pages) do
local link = t[1]
local display = t[2]
links[#links + 1] = formatLink(link, display)
end
local firstPageNs = findNamespaceId(firstPage)
local pagetype = firstPageNs == 0 and 'article' or 'page'
 
-- Make the formatted link text
local links = formatPageTables(pages)
links = mw.text.listToText(links)
-- Build the text.
local isPlural = #links pages > 1
local currentNs = currentTitle.namespace
local isCategoryNamespace = currentNs - currentNs % 2 == 14
links = mw.text.listToText(links)
local stringToFormat
if isCategoryNamespace then
Anonymous user

Navigation menu