Module:Cat see if

local p = {}

-- function catseeif function p.main (frame) local pprm = mw.getCurrentFrame: getParent.args; local slct = mw.ustring.sub (pprm[1] or '', 1, 1 );	-- 'o' if only 'of', 'f' when only 'from' local titl = mw.title.getCurrentTitle; local nspc = titl.nsText;		-- category local part = {}; local outt = {}; local alts = {}; alts[1] = 'Seals'; alts[2] = 'Flags'; alts[3] = 'Symbols'; alts[4] = 'Coats of arms';

part = mw.text.split( titl.text, ' of ', true) if	part[1] == 'Coats' then part[2] = part[3] part[1] = alts[4] end if part[1] ~= nil and part[2] ~= nil then if slct == '*' then slct = 'o' end for i = 1, 4 do			if alts[i] ~= part[1] then local namt = alts[i]..' of '..part[2] if slct ~= 'f' then 	-- not only 'from' ? local test = mw.title.new( namt, nspc ) if test.exists then table.insert( outt, namt ); end end end local namt = alts[i]..' from '..part[2] if slct ~= 'o' then 	-- not only 'of' ? local test = mw.title.new( namt, nspc ) if test.exists then table.insert( outt, namt ); end end end end --	part = mw.text.split( titl.text, ' from ', true) if part[1] ~= nil and part[2] ~= nil then if slct == '*' then slct = 'f' end for i = 1, 4 do			if alts[i] ~= part[1] then local namt = alts[i]..' from '..part[2] if slct ~= 'o' then 	-- not only 'of' ? local test = mw.title.new( namt, nspc ) if test.exists then table.insert( outt, namt ); end end end local namt = alts[i]..' of '..part[2] if slct ~= 'f' then 	-- not only 'from' ? local test = mw.title.new( namt, nspc ) if test.exists then table.insert( outt, namt ); end end end end if outt[1] ~= nil then table.insert( outt, "📎" ); return mw.getCurrentFrame:expandTemplate{ title = 'Cat see also', args = outt }; end end

return p;