Module:Disambiguation

local p = {}

function p.box(frame) local s_page = frame.args["page"] local s_title = frame.args["title"] local s_main_title = frame.args["main_title"] local s_main_name = frame.args["main_name"] local s_image = frame.args["image"] local s   local i    local j    local k    local s_name local s_reality

i = mw.ustring.find(s_page,"(",1,true)   j = mw.ustring.len(s_page)    s_reality = mw.ustring.sub(s_page, i+1, j-1)    s_name = mw.ustring.sub(s_page, 1, i-2)

if s_image == nil or s_image == "No Image Available At All.png" then s_image = "No Image Available.png" end s = '  ' if s_title ~= nil then i = mw.ustring.find(s_title,"",1,true)           if i ~= nil                 then                    j = mw.ustring.find(s_title, "",1,true) k = mw.ustring.find(s_title, "|",1,true) if k == nil then s_title = mw.ustring.sub(s_title, i+2, j-1) else s_title = mw.ustring.sub(s_title, k+1, j-1) end end end if s_title ~= s_main_title then if s_name == s_main_name then s = s..""..s_title.." " else s = s..""..s_title.." ("..s_name..") " end else if s_name ~= s_main_name then s = s..""..s_name.." " end end

s = s..frame:expandTemplate{ title = 'Number to Name', args = { s_reality } }..'('..s_reality..')'

return s..' ' end

return p