跳至內容
主選單
主選單
移至側邊欄
隱藏
導覽
首頁
近期變更
建立新頁面
隨機頁面
五大觀念?
新手使用指南
頁面存廢討論
百科財務報告
微國家百科
搜尋
搜尋
外觀
建立帳號
登入
個人工具
建立帳號
登入
檢視 模組:FUMO Regular Conferences 的原始碼
模組
討論
English
閱讀
檢視原始碼
檢視歷史
工具
工具
移至側邊欄
隱藏
操作
閱讀
檢視原始碼
檢視歷史
一般
連結至此的頁面
相關變更
頁面資訊
取得短網址
其他專案
外觀
移至側邊欄
隱藏
←
模組:FUMO Regular Conferences
由於以下原因,您無權編輯此頁面:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
local p = {} -- 輔助函數:根據狀態參數返回對應的背景顏色樣式和顯示文字 local function getStatusStyleAndText(status) if not status or status == "" then return "", "" end -- 標準化輸入:轉為小寫並去除前後空白 local s = mw.ustring.lower(mw.text.trim(status)) -- 判斷是否為「通過」(yes/y/是) if s == "yes" or s == "y" or s == "是" or s == "通過" then return 'style="background:#90FF90; text-align:center;"', "通過" -- 判斷是否為「否決」(no/n/否) elseif s == "no" or s == "n" or s == "否" or s == "否決" then return 'style="background:#FF9090; text-align:center;"', "否決" -- 判斷是否為「擱置」(shelved/s) elseif s == "shelved" or s == "s" or s == "擱置" then return 'style="background:#FFFF90; text-align:center;"', "擱置" -- 其他輸入則回傳空樣式和原始文字 else return 'style="text-align:center;"', status end end function p.renderTable(frame) -- 獲取所有參數 local args = frame:getParent().args local rows = {} -- 定義表格樣式 local tableStyle = 'class="wikitable plainrowheaders sticky-header" style="text-align:center; margin:auto;"' local headerStyle = 'style="background:#00334d; color:#FFF; text-align:center;"' -- 遍歷參數,構建行數據 -- 參數命名為 number, type, note, status, content, number1, type1, note1, status1, content1, ... local i = 0 while true do local suffix = (i == 0) and "" or tostring(i) local num = args["number" .. suffix] local ty = args["type" .. suffix] local cont = args["content" .. suffix] local stat = args["status" .. suffix] local nt = args["note" .. suffix] -- 如果找不到編號(核心標識),則停止循環 if num == nil then break end -- 將這一行數據存入表格 table.insert(rows, { number = num, type = ty or "", content = cont or "", status = stat or "", note = nt or "" }) i = i + 1 end -- 開始構建表格輸出 local result = {} table.insert(result, '{| ' .. tableStyle) -- 表頭 table.insert(result, '|-') table.insert(result, '! ' .. headerStyle .. ' | 編號') table.insert(result, '! ' .. headerStyle .. ' | 類型') table.insert(result, '! ' .. headerStyle .. ' | 內容') table.insert(result, '! ' .. headerStyle .. ' | 狀態') -- 遍歷行數據,生成表格行 for index, row in ipairs(rows) do -- 判斷是否為偶數行(雙數行使用灰色背景) local isEven = (index % 2 == 0) local rowBackground = isEven and 'style="background:#f2f5f7;"' or 'style="background:#FFFFFF;"' -- 獲取狀態的樣式(背景顏色)和顯示文字 local statusStyle, statusText = getStatusStyleAndText(row.status) -- 數據行(編號、類型、註釋使用斑馬背景) table.insert(result, '|-') table.insert(result, '| ' .. rowBackground .. ' | ' .. row.number) table.insert(result, '| ' .. rowBackground .. ' | ' .. row.type) table.insert(result, '| ' .. rowBackground .. ' | ' .. row.content) -- 狀態欄位:套用狀態顏色,覆蓋斑馬背景 table.insert(result, '| ' .. statusStyle .. ' | ' .. statusText) -- 內容行(合併四列,使用對應的斑馬背景) table.insert(result, '|-') table.insert(result, '| colspan="4" ' .. rowBackground .. ' | ' .. row.note) end -- 結束表格 table.insert(result, '|}') return table.concat(result, '\n') end return p
此頁面使用了以下模板:
模組:FUMO Regular Conferences/doc
(
檢視原始碼
)
返回到「
模組:FUMO Regular Conferences
」。
搜尋
搜尋
檢視 模組:FUMO Regular Conferences 的原始碼
新增話題