Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Feat: Difference between revisions

From Kronopolis and the Flat Plane
Attempting to remove all Spellcasting feats from being printed.
No edit summary
 
(26 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.list(frame)
function p.list(frame)
     local out = {}
     local out = {}
     local payload = {
     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',
         source=url .. '/api.php?action=query&format=json&list=categorymembers&cmlimit=max&cmtitle=Category:' .. util.firstToUpper(frame.args[1]) ..'_Feat',
         format='json'
         format='json'
     }
     }
     local json = mw.ext.externalData.getExternalData(payload)
     local data, errors = mw.ext.externalData.getExternalData(payload)
     for _,feat in ipairs(json) do
     for _,feat in ipairs(data) do
         if feat['title'] ~= nil then
         if (feat['title'] ~= nil) then
             if string.find(feat['title'],"-Level",1,true) == 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: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:expandTemplate({title=':' .. feat['title']}))
                 table.insert(out, frame:preprocess("\n----"))
                 table.insert(out, frame:preprocess('\n----'))
             end
             end
         end
         end
     end  
     end
     return table.concat(out)
     return table.concat(out)
end
end


return p
return p

Latest revision as of 20:00, 18 October 2025

Documentation for this module may be created at Module:Feat/doc

local p = {}

local util = require('Module:Utility')

local url = mw.site.server .. mw.site.scriptPath

function p.list(frame)
    local out = {}
    local payload = {
        source=url .. '/api.php?action=query&format=json&list=categorymembers&cmlimit=max&cmtitle=Category:' .. util.firstToUpper(frame.args[1]) ..'_Feat',
        format='json'
    }
    local data, errors = mw.ext.externalData.getExternalData(payload)
    for _,feat in ipairs(data) 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
    return table.concat(out)
end

return p