|
|
(11 intermediate revisions by the same user not shown) |
Line 2: |
Line 2: |
|
| |
|
| local util = require('Module:Utility') | | local util = require('Module:Utility') |
|
| |
| local url = mw.site.server .. mw.site.scriptPath
| |
|
| |
|
| function p.test(frame) | | function p.test(frame) |
| local out = {} | | local out = {} |
| local payload = { | | local pages = mw.ext.dpl.getPagenames{ |
| url=url .. '/api.php?action=query&format=json&list=categorymembers&cmlimit=max&cmtitle=Category:General_Feat', | | namespace='', |
| format='json' | | category=frame[1] |
| } | | } |
| local json = mw.ext.externalData.getExternalData(payload)
| |
| if (json ~= nil) then
| |
| for _,feat in ipairs(json) do
| |
| if (feat['title'] ~= nil) then
| |
| if (feat['title'] ~= frame.args['category']) and (string.find(feat['title'],'Category:') == nil) and (string.find(feat['title'],'feat/List') == nil) and (string.find(feat['title'],'-Level') == nil) then
| |
| table.insert(out, frame:preprocess('\n===' .. feat['title'] .. '===\n'))
| |
| table.insert(out, frame:expandTemplate({title='SmallLink', args = { feat['title'] } }))
| |
| table.insert(out, frame:expandTemplate({title=':' .. feat['title']}))
| |
| table.insert(out, frame:preprocess('\n----'))
| |
| end
| |
| end
| |
| end
| |
| else
| |
| table.insert(out,'mw.ext.externalData returned nil')
| |
| end
| |
| return table.concat(out)
| |
| end | | end |
|
| |
|
| return p | | return p |
Latest revision as of 11:43, 5 September 2025
Documentation for this module may be created at Module:Test/doc
local p = {}
local util = require('Module:Utility')
function p.test(frame)
local out = {}
local pages = mw.ext.dpl.getPagenames{
namespace='',
category=frame[1]
}
end
return p