「モジュール:SignalinstWiki」の版間の差分
細 モジュール調整 |
細編集の要約なし |
||
| (同じ利用者による、間の10版が非表示) | |||
| 77行目: | 77行目: | ||
function p.categoriesToTemplate(frame) | function p.categoriesToTemplate(frame) | ||
local | local args = { | ||
title = "カテゴリ一覧", | |||
opened = "False" | |||
} | |||
local categories = mw.text.trim( | |||
local categories = | frame:expandTemplate{ title = "カテゴリ一覧" } or "" | ||
) | ) | ||
local i = 1 | local i = 1 | ||
for category in mw.text.gsplit(categories | for category in mw.text.gsplit(categories, ",", true) do | ||
category = mw.text.trim(category) | |||
if category ~= "" then | if category ~= "" then | ||
local categoryName = mw.text.trim( | |||
local categoryName = category:gsub("^カテゴリ:", "") | category:gsub("^カテゴリ:", "") | ||
) | |||
local pages = mw.text.trim( | |||
local pages = | frame:expandTemplate{ | ||
title = "カテゴリ別ページ一覧", | |||
args = { category } | |||
} or "" | |||
) | ) | ||
args["header" .. i] = "[[:カテゴリ:"..categoryName.."|"..categoryName.."]]" | |||
args["content" .. i] = pages | |||
i = i + 1 | i = i + 1 | ||
| 113行目: | 108行目: | ||
end | end | ||
return frame:expandTemplate{ | |||
title = "ナビゲーションボックス", | |||
args = args | |||
} | |||
end | end | ||
return p | return p | ||