本WIKI由旅行者酒馆于2020年03月14日申请开通,内容按CC BY-NC-SA 4.0协议提供,编辑权限开放。
免责声明 • 反馈留言 • 编辑教程 • 收藏方法 • 评论管理规定 • 交流群:1018709157
感谢 大猫雷恩 对WIKI设计支持,期待更多能人异士加入原神WIKI。
全站通知:
模块:Voice actor
刷
历
编
跳到导航
跳到搜索
此模块的文档可以在模块:Voice actor/doc创建
------
-- Module:Voice actor
------
local p = {}
local getArgs = require('Module:Arguments').getArgs
-- String.split(string, key)
function split(s, k)
local rt = {}
string.gsub(
s,
'[^' .. k .. ']+',
function(w)
table.insert(rt, w)
end
)
return rt
end
-- String.trim(string)
function trim(s)
return (s:gsub('^%s*(.-)%s*$', '%1'))
end
-- Make link for voice actor
function makeLink(actorName, displayName)
local text = ''
actorName = trim(actorName)
displayName = trim(displayName) or actorName
text = text .. '[[Category:配音演员:' .. actorName .. ']]'
text = text .. '[[:Category:配音演员:' .. actorName .. '|' .. displayName .. ']]'
return text
end
-- Main function
function p.main(frame)
local args = getArgs(frame)
-- Nil
if args[1] == nil then
return '[[:Category:配音演员|配音演员]]'
end
-- Create empty variable
local text = {}
-- Get all actors
local allActors = split(args[1], ',')
-- Loop
for _, actor in pairs(allActors) do
local parts = split(actor, '|')
local actorName = parts[1]
local displayName = parts[2] or actorName
table.insert(text, makeLink(actorName, displayName))
end
-- Concat the table
text = table.concat(text, '<br>')
return text
end
-- end
return p

沪公网安备 31011002002714 号