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

模块:Schedule

来自星露谷物语扩展百科
[ 创建 | 刷新 ]文档页面
当前模块文档缺失,需要扩充。
-- =====================================================================
-- 模块:Schedule —— {{Daily}} 时间表生成器
--
-- 改动如下
--     :css('margin', '10px 0 10px 15px')   -->   :css('margin', '0')
--
-- 其余逻辑保持一致。
-- =====================================================================

local p = {}

function p.main(frame)
    local args = frame:getParent().args

    -- 使用原生 wikitable 类,确保暗色模式下背景色和文字颜色自动适配
    local tbl = mw.html.create('table')
        :addClass('wikitable')
        :css('width', '100%')
        :css('max-width', '600px')
        :css('margin', '0')
        :css('border-collapse', 'collapse')

    local tr_head = tbl:tag('tr')
    tr_head:tag('th'):css('width', '85px'):wikitext('时间')
    tr_head:tag('th'):wikitext('地点')

    local i = 1
    while args[i] do
        local tr = tbl:tag('tr')
        tr:tag('td'):wikitext(mw.text.trim(args[i]))
        tr:tag('td'):wikitext(args[i+1] and mw.text.trim(args[i+1]) or '')
        i = i + 2
    end

    return tostring(tbl)
end

return p