首页
历史
最近更改
特殊页面
社群首页
设置
关于Vocawiki
免责声明
Vocawiki
搜索
用户菜单
创建账号
登录
查看“︁Module:虚拟歌手外语排行榜”︁的源代码
←
Module:虚拟歌手外语排行榜
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} --提供给模板 local f = {} --内部使用 local VocalistColors = require("模块:Vocalist_Colors") function f.split(inputstr, sep) if sep == nil then sep = "%s" -- 如果没有提供分隔符,则默认为空格 else sep = mw.ustring.gsub(sep, '([%%%(%)%.%+%-%*%?%[%]%^%$])', '%%%1') -- 转义分隔符中的特殊字符 end local t = {} for str in mw.text.gsplit(inputstr, sep) do str = mw.ustring.gsub(str, '^%s*(.-)%s*$', '%1') -- 去除前后空白 if str ~= "" then -- 只插入非空字符串 table.insert(t, str) end end return t -- 返回分割后的结果表 end function p.color( frame ) local vocals=f.split(frame.args[1], "、") local count = #vocals if count == 1 then local color = VocalistColors.main({args = {vocals[1]}}) return color else local text = "linear-gradient(" for i,v in pairs(vocals) do local color = VocalistColors.main({args = {v}}) text = text .. color .. " " .. (100 / count) * (i - 1) .. "%, " .. color .. " " .. (100 / count) * i .. "%, " end text = string.sub(text, 1, -3) .. ")" return text end end function p.author(frame) local authors = f.split(frame.args[1], "、") local text = "" for i,v in pairs(authors) do if mw.ustring.match(v, "[あ-んア-ン]") then text = text .. frame:preprocess( "{{lj|[[" ..v .. "]]}}") .. "、" else text = text .. "[[" ..v .. "]]" .. "、" end end text = mw.ustring.sub(text, 1, -2) return text end return p
该页面使用的模板:
Module:虚拟歌手外语排行榜/doc
(
查看源代码
)
返回
Module:虚拟歌手外语排行榜
。