Module:Module sandbox: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Restored revision 1218873844 by Thisasia (talk)
Tags: Twinkle Undo Mobile edit Mobile web edit Advanced mobile edit
No edit summary
Tags: Reverted Mobile edit Mobile web edit Advanced mobile edit
Line 14: Line 14:
local imgc = args.imgc or ""
local imgc = args.imgc or ""
local imagesize = args.imagesize or ""
local imagesize = args.imagesize or ""
output = output .. '| style="text-align: center; width: ' .. imagesize .. ';" | [[File:' .. args.image .. '|thumb|upright=1.5|frameless|' .. imgc .. ']]\n|-\n'
output = output .. '| style="text-align: center; width: ' .. imagesize .. ';" | [[File:' .. args.image .. imgc .. ']]\n|-\n'
end
end



Revision as of 10:55, 14 April 2024

local p = {}

function p.infobox(frame)
    local args = frame:getParent().args
    local output = '{| class="infobox biography vcard" style="width: 22em;"\n'
    
    local description = args.description or ""
    
    if description ~= "" then
        output = output .. '| style="text-align: center; background-color: ' .. (args.descriptionbgcolor or "#f2f2f2") .. '; color: ' .. (args.descriptioncolor or "inherit") .. '; font-weight: bold;" | ' .. description .. '\n|-\n'
    end
    
    if args.image then
        local imgc = args.imgc or ""
        local imagesize = args.imagesize or ""  
        output = output .. '| style="text-align: center; width: ' .. imagesize .. ';" | [[File:' .. args.image  .. imgc .. ']]\n|-\n'
    end

    for key, value in pairs(args) do
        if type(key) == 'string' and key ~= 'description' and key ~= 'image' and key ~= 'imagecaption' and key ~= 'imgc' and key ~= 'imagesize' then
            output = output .. '| <b>' .. key .. '</b>\n| ' .. value .. '\n|-\n'
        end
    end
    
    output = output .. '|}\n'
    
    return output
end

return p