Module:Userbox: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
m (1 revision imported)
en>WOSlinker
(make edit request from User:Diriector_Doc and also changes to prefer named params to numbered params)
Line 82: Line 82:
local borderWidthNum = checkNum(args['border-width'] or args['border-s'], 1) -- Used to calculate width.
local borderWidthNum = checkNum(args['border-width'] or args['border-s'], 1) -- Used to calculate width.
data.borderWidth = addSuffix(borderWidthNum, 'px')
data.borderWidth = addSuffix(borderWidthNum, 'px')
data.borderColor = args['border-color'] or args[1] or args['border-c'] or args['id-c'] or '#999'
data.borderColor = args['border-color'] or args['border-c'] or args[1] or args['id-c'] or '#999'
data.width = addSuffix(240 - 2 * borderWidthNum, 'px') -- Also used in the table tag.
data.width = addSuffix(240 - 2 * borderWidthNum, 'px') -- Also used in the table tag.
data.bodyClass = args.bodyclass
data.bodyClass = args.bodyclass
Line 124: Line 124:
-- Get div tag values.
-- Get div tag values.
data.float = args.float or 'left'
data.float = args.float or 'left'
local borderWidthNum = checkNum(args[9] or args['border-s'], 1) -- Used to calculate width.
local borderWidthNum = checkNum(args['border-s'] or args[9], 1) -- Used to calculate width.
data.borderWidth = addSuffix(borderWidthNum, 'px')
data.borderWidth = addSuffix(borderWidthNum, 'px')
data.borderColor = args[1] or args['border-c'] or args['id1-c'] or '#999999'
data.borderColor = args['border-c'] or args[6] or args['id1-c'] or args[1] or '#999999'
data.width = addSuffix(240 - 2 * borderWidthNum, 'px') -- Also used in the table tag.
data.width = addSuffix(240 - 2 * borderWidthNum, 'px') -- Also used in the table tag.
data.bodyClass = args.bodyclass
data.bodyClass = args.bodyclass


-- Get table tag values.
-- Get table tag values.
data.backgroundColor = args[2] or args['info-c'] or '#eeeeee'
data.backgroundColor = args['info-c'] or args[2] or '#eeeeee'


-- Get info values.
-- Get info values.
data.info = args[4] or args.info or "<code>{{{info}}}</code>"
data.info = args.info or args[4] or "<code>{{{info}}}</code>"
data.infoTextAlign = args['info-a'] or 'left'
data.infoTextAlign = args['info-a'] or 'left'
data.infoFontSize = checkNumAndAddSuffix(args['info-s'], 8, 'pt')
data.infoFontSize = checkNumAndAddSuffix(args['info-s'], 8, 'pt')
data.infoColor = args[8] or args['info-fc'] or 'black'
data.infoColor = args['info-fc'] or args[8] or 'black'
data.infoPadding = args['info-p'] or '0 4px 0 4px'
data.infoPadding = args['info-p'] or '0 4px 0 4px'
data.infoLineHeight = args['info-lh'] or '1.25em'
data.infoLineHeight = args['info-lh'] or '1.25em'
Line 147: Line 147:
data.idWidth = checkNumAndAddSuffix(args['id1-w'], 45, 'px')
data.idWidth = checkNumAndAddSuffix(args['id1-w'], 45, 'px')
data.idHeight = checkNumAndAddSuffix(args['id-h'], 45, 'px')
data.idHeight = checkNumAndAddSuffix(args['id-h'], 45, 'px')
data.idBackgroundColor = args[1] or args['id1-c'] or '#dddddd'
data.idBackgroundColor = args['id1-c'] or args[1] or '#dddddd'
data.idTextAlign = 'center'
data.idTextAlign = 'center'
data.idFontSize = checkNumAndAddSuffix(args['id1-s'], 14, 'pt')
data.idFontSize = checkNumAndAddSuffix(args['id1-s'], 14, 'pt')
Line 160: Line 160:
data.id2Width = checkNumAndAddSuffix(args['id2-w'], 45, 'px')
data.id2Width = checkNumAndAddSuffix(args['id2-w'], 45, 'px')
data.id2Height = data.idHeight
data.id2Height = data.idHeight
data.id2BackgroundColor = args[7] or args['id2-c'] or args[1] or '#dddddd'
data.id2BackgroundColor = args['id2-c'] or args[7] or args[1] or '#dddddd'
data.id2TextAlign = 'center'
data.id2TextAlign = 'center'
data.id2FontSize = checkNumAndAddSuffix(args['id2-s'], 14, 'pt')
data.id2FontSize = checkNumAndAddSuffix(args['id2-s'], 14, 'pt')
Line 179: Line 179:
local borderWidthNum = checkNum(args['border-width'] or args['border-s'], 1) -- Used to calculate width.
local borderWidthNum = checkNum(args['border-width'] or args['border-s'], 1) -- Used to calculate width.
data.borderWidth = addSuffix(borderWidthNum, 'px')
data.borderWidth = addSuffix(borderWidthNum, 'px')
data.borderColor = args['border-color'] or args[1] or args['border-c'] or args['id-c'] or '#999'
data.borderColor = args['border-color'] or args['border-c'] or args[1] or args['id-c'] or '#999'
data.width = addSuffix(240 - 2 * borderWidthNum, 'px') -- Also used in the table tag.
data.width = addSuffix(240 - 2 * borderWidthNum, 'px') -- Also used in the table tag.
data.bodyClass = args.bodyclass
data.bodyClass = args.bodyclass