Модуль:Message box: различия между версиями

м 1 версия импортирована
м 1 версия импортирована
 
(не показана 1 промежуточная версия этого же участника)
Строка 169: Строка 169:
-- Add attributes, classes and styles.
-- Add attributes, classes and styles.
self.id = args.id
self.id = args.id
self.name = args.name
if self.name then
self:addClass('mbox-' .. string.gsub(self.name,' ','_'))
end
if yesno(args.plainlinks) ~= false then
if yesno(args.plainlinks) ~= false then
self:addClass('plainlinks')
self:addClass('plainlinks')
end
if args.mini then
self:addClass('ambox-mini')
end
end
for _, class in ipairs(cfg.classes or {}) do
for _, class in ipairs(cfg.classes or {}) do
Строка 225: Строка 224:
self.issue = args.smalltext
self.issue = args.smalltext
else
else
if args.sect and args.sect ~= '' or nil then
local sect
local issue_sect = args.issue_sect
if args.sect == '' then
issue_sect = type(issue_sect) == 'string' and issue_sect ~= '' and issue_sect or nil
sect = '<span style="font-weight:bold">Эта ' .. (cfg.sectionDefault or 'статья') .. '</span>'
local text_sect = args.text_sect
elseif type(args.sect) == 'string' then
text_sect = type(text_sect) == 'string' and text_sect ~= '' and text_sect or nil
sect = '<span style="font-weight:bold">' .. args.sect .. '</span>'
local issues = {}
table.insert(issues, issue_sect)
table.insert(issues, text_sect)
self.issue = table.concat(issues, ' ')
else
local issue = args.issue
issue = type(issue) == 'string' and issue ~= '' and issue or nil
local text = args.text
text = type(text) == 'string' and text or nil
local issues = {}
table.insert(issues, issue)
table.insert(issues, text)
self.issue = table.concat(issues, ' ')
end
end
local issue = args.issue
issue = type(issue) == 'string' and issue ~= '' and issue or nil
local text = args.text
text = type(text) == 'string' and text or nil
local issues = {}
table.insert(issues, sect)
table.insert(issues, issue)
table.insert(issues, text)
self.issue = table.concat(issues, ' ')
end
end


Строка 458: Строка 453:
if self.isSubstituted then
if self.isSubstituted then
self:addCat('all', 'Википедия:Страницы с ошибочно подставленными шаблонами')
self:addCat('all', 'Википедия:Страницы с ошибочно подставленными шаблонами')
end
if self.isSmall then
self:addCat(0, 'Википедия:Страницы с малыми шаблонами-сообщениями')
end
end
end
end
Строка 562: Строка 554:
textsmallCellDiv:tag('span')
textsmallCellDiv:tag('span')
:addClass('hide-when-compact')
:addClass('hide-when-compact')
:wikitext(self.talk and (' ' .. self.talk) or nil)
:wikitext(self.fix and (' ' .. self.fix) or nil)
:wikitext(self.fix and (' ' .. self.fix) or nil)
:wikitext(self.talk and (' ' .. self.talk) or nil)
end
if self.textsmall or self.fix or self.talk then
textsmallCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
else
textCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
end
end
textsmallCellDiv:wikitext(self.date and (' ' .. self.date) or nil)
if self.info and not self.isSmall then
if self.info and not self.isSmall then
textsmallCellDiv
textsmallCellDiv