「モジュール:SignalinstWiki」の版間の差分
細編集の要約なし |
細編集の要約なし |
||
| (同じ利用者による、間の6版が非表示) | |||
| 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="カテゴリ一覧"} | 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}} | frame:expandTemplate{ | ||
title = "カテゴリ別ページ一覧", | |||
args = { category } | |||
} or "" | |||
) | |||
args["header" .. i] = "[[:カテゴリ:"..categoryName.."|"..categoryName.."]]" | |||
args["content" .. i] = pages | |||
i = i + 1 | i = i + 1 | ||
end | end | ||
end | end | ||
return frame:expandTemplate{ | |||
title = "ナビゲーションボックス", | |||
args = args | |||
} | |||
end | end | ||
return p | return p | ||