Confirmedusers, Interface administrators
1,131
edits
m (Added image extension detection) |
mNo edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
function p.infobox( f ) | function p.infobox( f ) | ||
local args = require( 'Module:ProcessArgs' ).merge( true ) | local args = require( 'Module:ProcessArgs' ).merge( true ) | ||
local width = args.width or '250px' | |||
local titleObject = mw.title.getCurrentTitle() | local titleObject = mw.title.getCurrentTitle() | ||
local title = args.title or titleObject.baseText | local title = args.title or titleObject.baseText | ||
Line 8: | Line 9: | ||
subtitle = '<span style="font-size:15px"><b><i>"' .. args.subtitle .. '"</i></b></span>' | subtitle = '<span style="font-size:15px"><b><i>"' .. args.subtitle .. '"</i></b></span>' | ||
end | end | ||
local | local imageSize = args.imagesize or '180px' | ||
local imageString | local imageString | ||
local images = {} | local images = {} | ||
Line 27: | Line 28: | ||
elseif args.image then | elseif args.image then | ||
local image = args.image | local image = args.image | ||
if image:match('(.*).png') or image:match('(.*).jpg') or image:match('(.*).svg') then imageString = '[[File:' .. image .. '| | if image:match('(.*).png') or image:match('(.*).jpg') or image:match('(.*).svg') then imageString = '[[File:' .. image .. '|' .. imageSize .. ']]' | ||
else | else | ||
imageString = '[[File:' .. image .. '.png| | imageString = '[[File:' .. image .. '.png|' .. imageSize .. ']]' | ||
end | end | ||
else | else | ||
Line 36: | Line 37: | ||
local html = { | local html = { | ||
'<div style="margin: | '<div style="margin: 0 1em 1em; padding: 4px; border-color: #382b1e; border-width: 3px; border-style: solid; {{#if: {{{align|}}}|{{{align}}}|float:right}}; width:' .. width .. '; border-radius: 4px; background-color: #e0cfbb;">', | ||
'<table style="border-spacing: 2px; width: 100%;">', | '<table style="border-spacing: 2px; width: 100%;">', | ||
'<tr><th colspan="2" style="background: rgb(91,76,62); background: linear-gradient(to bottom, rgba(91,76,62,1) 0px, rgba(91,76,62,0) 5px, rgba(56,43,30,0) calc(100% - 5px), rgba(56,43,30,1) 100%), linear-gradient(to right, rgba(91,76,62,1) 0px, rgba(69,52,36,1) 5px, rgba(69,52,36,1) 50%, rgba(69,52,36,1) calc(100% - 5px), rgba(56,43,30,1) 100%);}}">', | '<tr><th colspan="2" style="background: rgb(91,76,62); background: linear-gradient(to bottom, rgba(91,76,62,1) 0px, rgba(91,76,62,0) 5px, rgba(56,43,30,0) calc(100% - 5px), rgba(56,43,30,1) 100%), linear-gradient(to right, rgba(91,76,62,1) 0px, rgba(69,52,36,1) 5px, rgba(69,52,36,1) 50%, rgba(69,52,36,1) calc(100% - 5px), rgba(56,43,30,1) 100%);}}">', |