Module:Resolve category redirect/sandbox explained

local p =

--Returns the target of, if it exists, else returns the original cat.function p.rtarget(cat) if string.match(cat, '[{}|]') then return cat end cat = string.gsub(cat, '^[Cc]ategory:', ) --"!" not recognized by mw.title.makeTitle otherwise local catcontent = mw.title.makeTitle('Category', cat or ):getContent if string.match(catcontent or , '