Module:Song:修订间差异
外观
无编辑摘要 |
无编辑摘要 |
||
第6行: | 第6行: | ||
local sl = slJson.songlist | local sl = slJson.songlist | ||
function module. | function module.test2(frame) | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local equalSign = args[1] | local equalSign = args[1] | ||
第16行: | 第16行: | ||
local resTable = {} | local resTable = {} | ||
for k,v in pairs(sl) do | for k,v in pairs(sl) do | ||
resTable[k] = | resTable[k] = k .. " 号歌曲是" | ||
if v.placeholding.tier == "none" or v.placeholding.tier == "weak" then | |||
resTable[k] = resTable[k] .. "'''" | |||
end | |||
resTable[k] = resTable[k] .. v.song.singers[1] .. "的《" .. v.song.name .. "》" | |||
if v.placeholding.tier == "none" or v.placeholding.tier == "weak" then | |||
resTable[k] = resTable[k] .. "'''" | |||
end | |||
end | end | ||
local outp = "" | local outp = "当前歌单数据的版本号为 " .. ver .. "。\n" | ||
for k,v in pairs(resTable) do | for k,v in pairs(resTable) do | ||
outp = string.rep("=", equalSign) .. k .. "号歌曲" .. string.rep("=", equalSign) .. "\n" | outp = outp .. string.rep("=", equalSign) .. k .. "号歌曲" .. string.rep("=", equalSign) .. "\n" | ||
outp = outp .. v .. "\n" | |||
end | end | ||
return outp | return outp | ||
第40行: | 第48行: | ||
end | end | ||
resTable[k] = resTable[k] .. table.concat(v.song.singers, "、") .. "的《" .. v.song.name .. "》" | resTable[k] = resTable[k] .. table.concat(v.song.singers, "、") .. "的《" .. v.song.name .. "》" | ||
if v.placeholding.tier == "none" or v.placeholding.tier == "weak" then | |||
resTable[k] = resTable[k] .. "'''" | |||
end | |||
end | end | ||
local outp = "当前歌单数据的版本号为 " .. ver .. "。\n" | local outp = "当前歌单数据的版本号为 " .. ver .. "。\n" |
2025年3月30日 (日) 20:59的版本
此模块的文档可以在Module:Song/doc创建
local module = {}
local getArgs = require('Module:Arguments').getArgs
local slJson = mw.loadJsonData('Module:Songlist-brief.json')
local ver = slJson.version
local sl = slJson.songlist
function module.test2(frame)
local args = getArgs(frame)
local equalSign = args[1]
if (equalSign == nil) then
equalSign = 3
else
equalSign = tonumber(equalSign)
end
local resTable = {}
for k,v in pairs(sl) do
resTable[k] = k .. " 号歌曲是"
if v.placeholding.tier == "none" or v.placeholding.tier == "weak" then
resTable[k] = resTable[k] .. "'''"
end
resTable[k] = resTable[k] .. v.song.singers[1] .. "的《" .. v.song.name .. "》"
if v.placeholding.tier == "none" or v.placeholding.tier == "weak" then
resTable[k] = resTable[k] .. "'''"
end
end
local outp = "当前歌单数据的版本号为 " .. ver .. "。\n"
for k,v in pairs(resTable) do
outp = outp .. string.rep("=", equalSign) .. k .. "号歌曲" .. string.rep("=", equalSign) .. "\n"
outp = outp .. v .. "\n"
end
return outp
end
function module.list(frame)
local args = getArgs(frame)
local equalSign = args[1]
if (equalSign == nil) then
equalSign = 3
else
equalSign = tonumber(equalSign)
end
local resTable = {}
for k,v in pairs(sl) do
resTable[k] = k .. " 号歌曲是"
if v.placeholding.tier == "none" or v.placeholding.tier == "weak" then
resTable[k] = resTable[k] .. "'''"
end
resTable[k] = resTable[k] .. table.concat(v.song.singers, "、") .. "的《" .. v.song.name .. "》"
if v.placeholding.tier == "none" or v.placeholding.tier == "weak" then
resTable[k] = resTable[k] .. "'''"
end
end
local outp = "当前歌单数据的版本号为 " .. ver .. "。\n"
for k,v in pairs(resTable) do
outp = outp .. string.rep("=", equalSign) .. k .. "号歌曲" .. string.rep("=", equalSign) .. "\n"
outp = outp .. v .. "\n"
end
return outp
end
return module