Module:Main

-- This module implements Template:Main.

local p = {}

function p._main(args) args[1] = args[1] or '' local links = {} for i, v in ipairs(args) do		links[i] = string.format(			'%s',			v,			args['l' .. i] or v:gsub("/Legends", "")		) end local prefix if #links > 1 then prefix = 'Main articles' else prefix = 'Main article' end links = mw.text.listToText(links) return string.format(		' %s: %s ',		prefix, links	) end

function p.main(frame) local args = {} for k, v in pairs(frame:getParent.args) do		v = v:match('^%s*(.-)%s*$') -- trim whitespace if v ~= '' then args[k] = v		end end return p._main(args) end

return p