Diferencia entre revisiones de «Módulo:Message box»
m
1 revision imported
m (1 revisión importada) |
m (1 revision imported) |
||
Línea 1: | Línea 1: | ||
require(' | require('strict') | ||
local getArgs | local getArgs | ||
local yesno = require('Module:Yesno') | local yesno = require('Module:Yesno') | ||
Línea 155: | Línea 155: | ||
self.typeClass = typeData.class | self.typeClass = typeData.class | ||
self.typeImage = typeData.image | self.typeImage = typeData.image | ||
self.typeImageNeedsLink = typeData.imageNeedsLink | |||
-- Find if the box has been wrongly substituted. | -- Find if the box has been wrongly substituted. | ||
Línea 187: | Línea 188: | ||
-- Set text style. | -- Set text style. | ||
self.textstyle = args.textstyle | self.textstyle = args.textstyle | ||
-- Set image classes. | |||
self.imageRightClass = args.imagerightclass or args.imageclass | |||
self.imageLeftClass = args.imageleftclass or args.imageclass | |||
-- Find if we are on the template page or not. This functionality is only | -- Find if we are on the template page or not. This functionality is only | ||
Línea 329: | Línea 334: | ||
and (cfg.imageSmallSize or '30x30px') | and (cfg.imageSmallSize or '30x30px') | ||
or '40x40px' | or '40x40px' | ||
self.imageLeft = string.format('[[File:%s|%s | self.imageLeft = string.format('[[File:%s|%s%s|alt=]]', self.typeImage | ||
or ' | or 'Information icon4.svg', imageSize, self.typeImageNeedsLink and "" or "|link=" ) | ||
end | end | ||
end | end | ||
Línea 518: | Línea 523: | ||
imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div') | imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div') | ||
end | end | ||
imageLeftCell:wikitext(self.imageLeft or nil) | imageLeftCell | ||
:addClass(self.imageLeftClass) | |||
:wikitext(self.imageLeft or nil) | |||
elseif self.imageEmptyCell then | elseif self.imageEmptyCell then | ||
-- Some message boxes define an empty cell if no image is specified, and | -- Some message boxes define an empty cell if no image is specified, and | ||
Línea 573: | Línea 580: | ||
end | end | ||
imageRightCell | imageRightCell | ||
:addClass(self.imageRightClass) | |||
:wikitext(self.imageRight or nil) | :wikitext(self.imageRight or nil) | ||
end | end |