跳转到内容

Module:Song:修订间差异

此后如竟没有炬火,我便是唯一的光。
荆哲留言 | 贡献
无编辑摘要
荆哲留言 | 贡献
无编辑摘要
第40行: 第40行:
end
end
if v.placeholding.tier ~= "none" then
if v.placeholding.tier ~= "none" then
resTable[k] = resTable[k] .. ",原版为" .. lang[v.placeholding.language] .. "版:"
resTable[k] = resTable[k] .. ",原版为" .. v.placeholding.language .. "版:"
if v.placeholding.tier == "strong" then
if v.placeholding.tier == "strong" then
resTable[k] = resTable[k] .. "'''"
resTable[k] = resTable[k] .. "'''"

2025年3月30日 (日) 21:32的版本

此模块的文档可以在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
local lang = {["qsd"] = "希顶语", ["zxx"] = "纯音乐", ["cmn"] = "国语", ["eng"] = "英语", ["jpn"] = "日语", ["mul"] = "多语种", ["nap"] = "意大利语那不勒斯方言", ["ron"] = "罗马尼亚语", ["yue"] = "粤语"}

function myConcat(l)
	local ret = ""
	local bj = 0
	for k,v in pairs(l) do
		if bj == 0 then
			bj = 1
		else
			ret = ret .. "、"
		end
		ret = ret .. v
	end
	return ret
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] .. myConcat(v.song.singers) .. "的《" .. v.song.name .. "》"
		if v.placeholding.tier == "none" or v.placeholding.tier == "weak" then
			resTable[k] = resTable[k] .. "'''"
		end
		if v.placeholding.tier ~= "none" then
			resTable[k] = resTable[k] .. ",原版为" .. v.placeholding.language .. "版:"
			if v.placeholding.tier == "strong" then
				resTable[k] = resTable[k] .. "'''"
			end
			resTable[k] = resTable[k] .. myConcat(v.placeholding.song.singers) .. "的《" .. v.placeholding.song.name .. "》"
			if v.placeholding.tier == "strong" then
				resTable[k] = resTable[k] .. "'''"
			end
		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