Module:Test: Difference between revisions

From Elwiki
No edit summary
No edit summary
Tag: Manual revert
 
Line 1: Line 1:
require('Module:CommonFunctions')
require('Module:InfoboxProto');
local getArgs = require('Module:Arguments').getArgs
local p = {}
local p = {}
-- Main process
function p.main(frame)
function p.main(frame)
     local passive = frame:preprocess("{{:Dark Force}}{{#arrayindex:dark_force|0}}, {{#arrayindex:dark_force|1}}")
     local args = getArgs(frame);
    if string.match(passive, "%d%.%d,%s%d%.%d") then
    local infobox = require('Module:InfoboxProto').main(frame, args.title);
         return 'matched'
    local divclass = args.divclass;
    else
    if divclass == nil then
        return passive
         divclass = 'custom'
     end
     end
    infobox:addClass('infobox-' .. divclass);
    for k, v in spairs(args) do
        if string.match(k, 'data[0-9]+') ~= nil then
            local i = k:gsub('data', '');
            addField('data' .. i, args['label' .. i])
        end
    end
   
    return tostring(infobox);
end
end
return p
return p

Latest revision as of 15:22, 17 June 2024

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

require('Module:CommonFunctions')
require('Module:InfoboxProto');
local getArgs = require('Module:Arguments').getArgs
local p = {}

-- Main process
function p.main(frame)
    local args = getArgs(frame);
    local infobox = require('Module:InfoboxProto').main(frame, args.title);
    local divclass = args.divclass;
    if divclass == nil then
        divclass = 'custom'
    end
    infobox:addClass('infobox-' .. divclass);

    for k, v in spairs(args) do
        if string.match(k, 'data[0-9]+') ~= nil then
            local i = k:gsub('data', '');
            addField('data' .. i, args['label' .. i])
        end
    end
    
    return tostring(infobox);

end

return p