跳至內容
主選單
主選單
移至側邊欄
隱藏
導覽
首頁
近期變更
建立新頁面
隨機頁面
五大觀念?
新手使用指南
頁面存廢討論
百科財務報告
微國家百科
搜尋
搜尋
外觀
建立帳號
登入
個人工具
建立帳號
登入
檢視 模組:FUMOCount 的原始碼
模組
討論
English
閱讀
檢視原始碼
檢視歷史
工具
工具
移至側邊欄
隱藏
操作
閱讀
檢視原始碼
檢視歷史
一般
連結至此的頁面
相關變更
頁面資訊
取得短網址
其他專案
外觀
移至側邊欄
隱藏
←
模組:FUMOCount
由於以下原因,您無權編輯此頁面:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
local p = {} local TARGET_PAGE = "聯合微國家組織會員國列表" local function getContent() return mw.title.new(TARGET_PAGE):getContent() or "" end local function countMatches(s) local n = 0 for _ in s:gmatch("AutonumTable/index") do n = n + 1 end return n end -- 從區段內依序擷取每個 AutonumTable/index 後的第一個 flag 名稱 local function extractFlags(section) local flags = {} local pos = 1 while true do local iStart, iEnd = section:find("AutonumTable/index", pos) if not iStart then break end -- 從 index 之後找最近的 {{flag|...}} 或 {{Flag|...}} local flagName = section:match("%{%{[Ff]lag%|([^}]+)%}%}", iEnd) if flagName then flagName = flagName:match("^%s*(.-)%s*$") table.insert(flags, flagName) end pos = iEnd + 1 end return flags end -- 成員國數 function p.chengyuan(frame) local c = getContent() local section = c:match("%{%{!!%}%} 成員國 %{%{!!%}%}(.-)%{%{!!%}%} 觀察國 %{%{!!%}%}") if not section then return 0 end return countMatches(section) end -- 觀察國數(限定至 id=fumoguanchaguo,避免計入前會員國) function p.guancha(frame) local c = getContent() local section = c:match("%{%{!!%}%} 觀察國 %{%{!!%}%}(.-)id=fumoguanchaguo") if not section then return 0 end return countMatches(section) end -- 會員國總數(限定至 id=fumoguanchaguo,避免計入前會員國) function p.total(frame) local c = getContent() local section = c:match("(.-)id=fumoguanchaguo") if not section then return 0 end return countMatches(section) end -- 輸出成員國列表,供導覽框使用 function p.chengyuanList(frame) local c = getContent() local section = c:match("%{%{!!%}%} 成員國 %{%{!!%}%}(.-)%{%{!!%}%} 觀察國 %{%{!!%}%}") if not section then return "" end local flags = extractFlags(section) local lines = {} for _, name in ipairs(flags) do table.insert(lines, "* <span style=\"white-space:nowrap;\">{{flag|" .. name .. "}}</span>") end local wikitext = table.concat(lines, "\n") return frame:preprocess(wikitext) end -- 輸出觀察國列表,供導覽框使用(限定至 id=fumoguanchaguo,避免輸出前會員國) function p.guanchaList(frame) local c = getContent() local section = c:match("%{%{!!%}%} 觀察國 %{%{!!%}%}(.-)id=fumoguanchaguo") if not section then return "" end local flags = extractFlags(section) local lines = {} for _, name in ipairs(flags) do table.insert(lines, "* <span style=\"white-space:nowrap;\">{{flag|" .. name .. "}}</span>") end local wikitext = table.concat(lines, "\n") return frame:preprocess(wikitext) end return p
此頁面使用了以下模板:
模組:FUMOCount/doc
(
檢視原始碼
)
返回到「
模組:FUMOCount
」。
搜尋
搜尋
檢視 模組:FUMOCount 的原始碼
新增話題