Module:Similar

local p = {} --p stands for package

local getArgs = require('Module:Arguments').getArgs local yesno = require('Module:Yesno')

function p.similar(frame) local args = getArgs(frame) local all = yesno(args.all) or false local namespace = args.namespace or mw.title.getCurrentTitle.nsText local page_text if all then page_text = "works, authors or portals with similar titles or names" elseif namespace == "Author" then page_text = "authors with similar names" elseif namespace == "Portal" then page_text = "portals with similar names" else page_text = "works with similar titles" end local link_table = {} for k, v in pairs(args) do		if tonumber(k) then table.insert(link_table, 1, "" .. v .. "") end end local link_text = "" -- default value if #link_table == 1 then link_text = link_table[1] elseif #link_table == 2 then link_text = link_table[1] .. " and " .. link_table[2] elseif #link_table > 2 then link_text = link_table[1] for i = 2, #link_table - 1, 1 do link_text = link_text .. ", " .. link_table[i] end link_text = link_text .. ", and " .. link_table[#link_table] end local openingDiv = '' return openingDiv .. 'For ' .. page_text .. ', see ' .. link_text .. '. ' end

return p