打开/关闭菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:系列:修订间差异

来自Cookie☆Wiki
(允许对特定的条目隐藏某些条目)
(潜在 bug)
第19行: 第19行:
local name_of_this_voice_drama = nil
local name_of_this_voice_drama = nil
for _, voice_drama in ipairs(series) do
for _, voice_drama in ipairs(series) do
if type(voice_drama) == 'table' then
if type(voice_drama) == 'string' then
local hide_for = voice_drama['hide_for']
voice_drama = { name = voice_drama }
if hide_for ~= nil then
else
end
if type(hide_for) == 'string' then
hide_for = { hide_for }
end


local hide_for = voice_drama['hide_for']
if name_of_this_voice_drama == nil then
if hide_for ~= nil then
name_of_this_voice_drama = frame.args[2] or frame:getParent():getTitle()
end
if type(hide_for) == 'string' then
hide_for = { hide_for }
end


if name_of_this_voice_drama == nil then
for _, vd_h in ipairs(hide_for) do
if name_of_this_voice_drama == vd_h then
name_of_this_voice_drama = frame.args[2] or frame:getParent():getTitle()
hide_for = true
end
break
end
end
if hide_for ~= true then
hide_for = false
end


for _, vd_h in ipairs(hide_for) do
if name_of_this_voice_drama == vd_h then
hide_for = true
break
end
end
end
if not hide_for then
if hide_for ~= true then
hide_for = false
wikitext = wikitext .. '* [[' .. voice_drama['name'] .. ']] ー ' .. voice_drama['note'] .. '\n'
end
end

else
end
wikitext = wikitext .. '* [[' .. voice_drama .. ']]\n'
if not hide_for then
wikitext = wikitext .. '* [[' .. voice_drama['name'] .. ']]'
local note = voice_drama['note']
if note ~= nil then
wikitext = wikitext .. ' ' .. note .. '\n'
end
end
end
end
end

2019年5月14日 (二) 18:03的版本

此模块的文档可以在模块:系列/doc创建

local p = {}

local series_table = mw.loadData('Module:系列/data')

--! 生成声剧系列的列表
--! @param 1 系列名
function p.generate_list()
    local frame = mw.getCurrentFrame()
    local series_name = frame.args[1]
    if series_name == nil then
        return ''
    end
    series = series_table[series_name]
    if series == nil then
        return ''
    end

    local wikitext = ''
    local name_of_this_voice_drama = nil
    for _, voice_drama in ipairs(series) do
        if type(voice_drama) == 'string' then
            voice_drama = { name = voice_drama }
        else
        end

        local hide_for = voice_drama['hide_for']
        if hide_for ~= nil then
            if type(hide_for) == 'string' then
                hide_for = { hide_for }
            end

            if name_of_this_voice_drama == nil then
                name_of_this_voice_drama = frame.args[2] or frame:getParent():getTitle()
            end

            for _, vd_h in ipairs(hide_for) do
                if name_of_this_voice_drama == vd_h then
                    hide_for = true
                    break
                end
            end
            if hide_for ~= true then
                hide_for = false
            end

        end
        if not hide_for then
             wikitext = wikitext .. '* [[' .. voice_drama['name'] .. ']]'
             local note = voice_drama['note']
             if note ~= nil then
                wikitext = wikitext .. ' ー ' .. note .. '\n'
             end
        end
    end

    return wikitext
end

return p