LLWiki正在建设中,欢迎加入我们!
“模块:Radio-list”的版本间差异
跳转到导航
跳转到搜索
小 |
|||
第39行: | 第39行: | ||
if i == 1 then |
if i == 1 then |
||
local date = date(v) |
local date = date(v) |
||
result = result.."\n|-\n|"..(date[1] == 1 and id or " |
result = result.."\n|-\n|"..(date[1] == 1 and id or "style=\"text-align:center\"|–").."||"..date[2] |
||
id = id + date[1] |
id = id + date[1] |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
else |
else |
||
rowspan[i] = rowspan[i] or 0 |
rowspan[i] = rowspan[i] or 0 |
||
第57行: | 第50行: | ||
rowspan[i] = span(td[1]) - 1 |
rowspan[i] = span(td[1]) - 1 |
||
end |
end |
||
if i == |
if i == (ncvcols % ncols) then |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
result = result.."||"..(td[1] and td[1].."|" or "")..td[2] |
result = result.."||"..(td[1] and td[1].."|" or "")..td[2] |
||
elseif i == urlcol then |
elseif i == urlcol then |
2021年4月19日 (一) 22:47的版本
local getArgs = require('Module:Arguments').getArgs local p = {} function date(str) local skip = 1 if str:sub(1, 1) == 's' then skip = 0 str = mw.ustring.gsub(str, "^%D+", "") end return {skip, mw.ustring.gsub(str, "([年月])0?(%d+)", "%1<span class=\"countdown-num\">%2</span>")} end function cell(str) local property, value = mw.ustring.match(str, "([^|]*)|(.*)") return {property, value or str} end function span(str) return mw.ustring.match(str, "rowspan%s*=%s*[\"\']?(%d+)") or 1 end function p.main(frame) local args = getArgs(frame, {removeBlanks = false}) local result = "{|class=\"wikitable radio-list"..(args.comment and " radio-with-comment" or "").."\"\n!#!!配信日期" local ncols = 2 + (args.comment and 1 or 0) local ncvcols = 2 local cvcols = args.cvcols and mw.text.split(args.cvcols, "、") or {} for k,v in ipairs(cvcols) do ncols = ncols + 1 ncvcols = ncvcols + 1 result = result.."!!"..v end result = result.."!!视频资料"..(args.comment and "!!備註" or "") local id = args.start or 1 local rowspan = {} local urlcol = tonumber(args.urlcol) for k,v in ipairs(args) do local i = k % ncols if i == 1 then local date = date(v) result = result.."\n|-\n|"..(date[1] == 1 and id or "style=\"text-align:center\"|–").."||"..date[2] id = id + date[1] else rowspan[i] = rowspan[i] or 0 if rowspan[i] > 0 then rowspan[i] = rowspan[i] - 1 else local td = cell(v) if td[1] then rowspan[i] = span(td[1]) - 1 end if i == (ncvcols % ncols) then local video = string.match(td[2], "^[%l%u%d]+") local link = string.match(td[2], "^[%l%u%d%p]+") local label = mw.ustring.match(td[2], "【(.+)】") result = result.."||"..(td[1] or "").. (video and " |<div class=\"video-link\">[https://www.bilibili.com/video/"..link.." "..video.."]"..(label or "").."</div>" or " style=\"text-align:center\"|–") elseif i == 0 then result = result.."||"..(td[1] and td[1].."|" or "")..td[2] elseif i == urlcol then result = result.."||"..(td[1] or "").. (td[2] == "" and " |–" or " class=\"video-link\"|[https://www.bilibili.com/read/"..td[2].." "..td[2].."]") else result = result.."||"..(td[1] or "").. (td[2] == "" and " class=\"table-none\"| " or (" |"..frame:expandTemplate{title = "memberlink/cv", args = mw.text.split(td[2], "、")})) end end end end return result.."\n|}" end return p