\/a>","copyright":"
alias = { ["0m"] = "5m*", ["0p"] = "5p*", ["0s"] = "5s*", ["0z"] = "5z*", Em = "3m*", Ep = "3p*", Es = "3s*", Zs = "2s", Rs = "3s", ton = "1z", azuma = "1z", dong = "1z", nan = "2z", minami = "2z", sha = "3z", shaa = "3z", nishi = "3z", xi = "3z", pe = "4z", pee = "4z", pei = "4z", hoku = "4z", bei = "4z", haku = "5z", shiro = "5z", bai = "5z", baiban = "5z", ["8z"] = "5z", hatsu = "6z", fa = "6z", ao = "6z", Bz = "6z", chung = "7z", zhong = "7z", hongzhong = "7z", ["9z"] = "#", haru = "1k", chun = "1k", natsu = "2k", xia = "2k", aki = "3k", qiu = "3k", fuyu = "4k", Dong = "4k", ume = "5k", mei = "5k", ran = "6k", lan = "6k", take = "7k", zhu = "7k", kiku = "8k", ju = "8k", ["9k"] = "#" } return { main = function(frame) local s = frame.args[1] local l = s:len() local rot = false -- rotate local rpl = false -- rotate plus local red = false local cyan = false if l == 1 then return "🀫" end local flag = true while flag do -- handle tags flag = false if s:sub(l, l) == "r" then s = s:sub(1, l - 1) rot = true flag = true l = l - 1 end if s:sub(l, l) == "j" then s = s:sub(1, l - 1) rpl = true flag = true l = l - 1 end if (l >= 6 and (s:sub(l - 3, l) == "_aka" or s:sub(l - 3, l) == "_red")) then s = s:sub(1, l - 4) red = true flag = true l = l - 4 end if (l >= 6 and (s:sub(l - 2, l) == "_ao" or s:sub(l - 4, l) == "_cyan")) then s = s:sub(1, l - 4) cyan = true flag = true l = l - 4 end if (l >= 5 and s:sub(l - 2, l) == "_gb") then -- do nothing here s = s:sub(1, l - 3) flag = true l = l - 3 end end -- handle tags end if alias[s] then s = alias[s] end l = s:len() if l == 1 then return '<span class = "hai">🀫</span>' end if l == 3 and s:sub(l, l) == "*" then red = true s = s:sub(1, 2) l = 2 end if l == 3 and s:sub(l, l) == "^" then cyan = true s = s:sub(1, 2) l = 2 end local red_id = -1 if rpl and l == 3 then if s:sub(1, 1) == "0" then s = "5" .. s:sub(3, 3) red_id = 1 elseif s:sub(2, 2) == "0" then s = "5" .. s:sub(3, 3) red_id = 2 elseif s:sub(1, 1) == "E" then s = "3" .. s:sub(3, 3) red_id = 1 elseif s:sub(2, 2) == "E" then s = "3" .. s:sub(3, 3) red_id = 2 end l = 2 end if l ~= 2 then return '<strong class = "error">错误格式</strong>' end local suit = s:sub(l, l) local id = s:sub(1, l-1) local ret local real_id = tonumber(id) if not real_id then return '<strong class = "error">错误格式</strong>' end if suit == "m" then ret = ("&#%d;"):format(126982+real_id) elseif suit == "p" then ret = ("&#%d;"):format(127000+real_id) elseif suit == "s" then ret = ("&#%d;"):format(126991+real_id) elseif suit == "z" then if real_id > 4 then real_id = 12 - real_id -- 7 -> 5; 5 -> 7; 6 -> 6 end ret = ("&#%d;"):format(126975+real_id) elseif suit == "k" then if real_id > 4 then real_id = real_id - 4 else real_id = real_id + 4 end ret = ("&#%d;"):format(127009+real_id) else return '<strong class = "error">错误格式</strong>' end if red then ret = '<span class = "aka" style="color:red" title = "赤宝牌">'..ret..'</span>' elseif cyan then ret = '<span class = "ao" style="color:cyan" title = "青宝牌">'..ret..'</span>' else ret = '<span class = "normal">'..ret..'</span>' end if rot then local obj = mw.html.create("span") obj:addClass("naki"):tag("span"):addClass("rotate"):wikitext(ret) ret = tostring(obj) elseif rpl then local obj = mw.html.create("span") obj:addClass("kakan") local ret1 = ret local ret2 = ret if red_id == 1 then ret1 = '<span class = "aka" style="color:red" title = "赤宝牌">'..ret..'</span>' elseif red_id == 2 then ret2 = '<span class = "aka" style="color:red" title = "赤宝牌">'..ret..'</span>' end obj:tag("span"):addClass("naki"):tag("span"):addClass("rotate"):wikitext(ret1) obj:tag("span"):addClass("naki"):tag("span"):addClass("rotate"):wikitext(ret2) ret = tostring(obj) end return ret end }