Editing Module:Message box
From WikiOasis Meta
More actions
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 155: | Line 155: | ||
self.typeClass = typeData.class | self.typeClass = typeData.class | ||
self.typeImage = typeData.image | self.typeImage = typeData.image | ||
-- Find if the box has been wrongly substituted. | -- Find if the box has been wrongly substituted. | ||
| Line 166: | Line 165: | ||
) | ) | ||
-- Add attributes, classes and styles. | -- Add attributes, classes and styles. | ||
self.id = args.id | self.id = args.id | ||
| Line 177: | Line 173: | ||
if yesno(args.plainlinks) ~= false then | if yesno(args.plainlinks) ~= false then | ||
self:addClass('plainlinks') | self:addClass('plainlinks') | ||
end | end | ||
for _, class in ipairs(cfg.classes or {}) do | for _, class in ipairs(cfg.classes or {}) do | ||
| Line 194: | Line 187: | ||
-- Set text style. | -- Set text style. | ||
self.textstyle = args.textstyle | self.textstyle = args.textstyle | ||
-- 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 | ||
| Line 274: | Line 263: | ||
local talkText | local talkText | ||
if self.isSmall then | if self.isSmall then | ||
local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. | local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. '#' .. talk) | ||
talkText = string.format('([[%s|talk]])', talkLink) | talkText = string.format('([[%s|talk]])', talkLink) | ||
else | else | ||
| Line 287: | Line 276: | ||
else | else | ||
talkText = string.format( | talkText = string.format( | ||
'%s the [[%s | '%s the [[%s#%s|talk page]].', | ||
talkText, | talkText, | ||
talkTitle.prefixedText, | talkTitle.prefixedText, | ||
| Line 322: | Line 311: | ||
self.text = args.text | self.text = args.text | ||
end | end | ||
-- Set the below row. | |||
self.below = cfg.below and args.below | |||
-- General image settings. | -- General image settings. | ||
| Line 337: | Line 329: | ||
and (cfg.imageSmallSize or '30x30px') | and (cfg.imageSmallSize or '30x30px') | ||
or '40x40px' | or '40x40px' | ||
self.imageLeft = string.format('[[File:%s| | self.imageLeft = string.format('[[File:%s|%s|link=|alt=]]', self.typeImage | ||
or 'Information icon4.svg', imageSize | or 'Information icon4.svg', imageSize) | ||
end | end | ||
end | end | ||
| Line 471: | Line 463: | ||
page = self.args.page | page = self.args.page | ||
} | } | ||
end | end | ||
function MessageBox:export() | function MessageBox:export() | ||
local root = mw.html.create() | local root = mw.html.create() | ||
| Line 657: | Line 518: | ||
imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div') | imageLeftCell = imageLeftCell:tag('div'):addClass('mbox-image-div') | ||
end | end | ||
imageLeftCell | imageLeftCell: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 | ||
| Line 714: | Line 573: | ||
end | end | ||
imageRightCell | imageRightCell | ||
:wikitext(self.imageRight or nil) | :wikitext(self.imageRight or nil) | ||
end | end | ||
| Line 761: | Line 619: | ||
box:setParameters() | box:setParameters() | ||
box:setCategories() | box:setCategories() | ||
return box:export() | return box:export() | ||
end | end | ||