More actions
mNo edit summary |
mNo edit summary |
||
Line 11: | Line 11: | ||
local json = mw.ext.externalData.getExternalData(payload) | local json = mw.ext.externalData.getExternalData(payload) | ||
for _,feat in ipairs(json) do | for _,feat in ipairs(json) do | ||
if | if feat['title'] ~= nil then | ||
if feat['title'] | if string.find(feat['title'],"-Level",1,true) == nil and string.find(feat['title'],"Category:",1,true) == nil then | ||
table.insert(out, frame:preprocess("\n==='''[[" .. feat['title'] .. "]]'''===\n")) | |||
table.insert(out, frame:expandTemplate({title=':' .. feat['title']})) | |||
table.insert(out, frame:preprocess("\n----")) | |||
end | end | ||
end | end |
Revision as of 01:48, 15 January 2024
Documentation for this module may be created at Module:Feat/doc
local p = {}
local util = require('Module:Utility')
function p.list(frame)
local out = {}
local payload = {
source=mw.site.server .. mw.site.scriptPath .. '/api.php?action=query&format=json&list=categorymembers&cmlimit=max&cmtitle=Category:' .. util.firstToUpper(frame.args[1]) ..'_Feat',
format='json'
}
local json = mw.ext.externalData.getExternalData(payload)
for _,feat in ipairs(json) do
if feat['title'] ~= nil then
if string.find(feat['title'],"-Level",1,true) == nil and string.find(feat['title'],"Category:",1,true) == nil then
table.insert(out, frame:preprocess("\n==='''[[" .. feat['title'] .. "]]'''===\n"))
table.insert(out, frame:expandTemplate({title=':' .. feat['title']}))
table.insert(out, frame:preprocess("\n----"))
end
end
end
return table.concat(out)
end
return p