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