打开/关闭菜单
322
1.7K
132
12.6K
星露谷物语扩展百科
打开/关闭外观设置菜单
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。

模块:Schedule:修订间差异

来自星露谷物语扩展百科
Tangobear留言 | 贡献
创建页面,内容为“local p = {} function p.main(frame) local parent_args = frame:getParent().args local args = {} local max_key = 0 for k, v in pairs(parent_args) do local num_key = tonumber(k) if num_key and num_key > 0 and math.floor(num_key) == num_key then args[num_key] = v if num_key > max_key then max_key = num_key end end end local result = {} table.insert(result, '<table class="wikitable scheduleheader">') table.insert(result, '<tr><th style=…”
标签已重建
 
Tangobear留言 | 贡献
无编辑摘要
第2行: 第2行:


function p.main(frame)
function p.main(frame)
local parent_args = frame:getParent().args
    local args = frame.args
local args = {}
    local tbl = mw.html.create('table')
local max_key = 0
        :addClass('schedule-table wikitable roundedborder')
        :css('table-layout', 'auto')
        :css('width', '100%')
        :css('max-width', '100%')


for k, v in pairs(parent_args) do
    local tr_head = tbl:tag('tr')
local num_key = tonumber(k)
    tr_head:tag('th'):wikitext('时间')
if num_key and num_key > 0 and math.floor(num_key) == num_key then
    tr_head:tag('th'):wikitext('地点')
args[num_key] = v
if num_key > max_key then
max_key = num_key
end
end
end


local result = {}
    local i = 1
table.insert(result, '<table class="wikitable scheduleheader">')
    while args[i] do
table.insert(result, '<tr><th style="width: 15%;">时间</th><th style="width: 85%;">地点</th></tr>')
        local tr = tbl:tag('tr')
        tr:tag('td'):wikitext(args[i])
        i = i + 1
        tr:tag('td'):wikitext(args[i])
        i = i + 1
    end


for i = 1, max_key, 2 do
    return tostring(tbl)
local time = args[i] or ''
local location = args[i + 1] or ''
 
if time ~= '' then
local row = string.format('<tr><td>%s</td><td>%s</td></tr>', time, location)
table.insert(result, row)
end
end
 
table.insert(result, '</table>')
 
return table.concat(result, '\n')
end
end


return p
return p

2026年4月20日 (一) 22:44的版本

[ 创建 | 刷新 ]文档页面
当前模块文档缺失,需要扩充。
local p = {}

function p.main(frame)
    local args = frame.args
    local tbl = mw.html.create('table')
        :addClass('schedule-table wikitable roundedborder')
        :css('table-layout', 'auto')
        :css('width', '100%')
        :css('max-width', '100%')

    local tr_head = tbl:tag('tr')
    tr_head:tag('th'):wikitext('时间')
    tr_head:tag('th'):wikitext('地点')

    local i = 1
    while args[i] do
        local tr = tbl:tag('tr')
        tr:tag('td'):wikitext(args[i])
        i = i + 1
        tr:tag('td'):wikitext(args[i])
        i = i + 1
    end

    return tostring(tbl)
end

return p