Módulo:Message box: Diferenzas entre revisións
Contido eliminado Contido engadido
Sen resumo de edición |
update |
||
Liña 1:
-- This is a meta-module for producing message box templates, including
-- {{mbox}}, {{ambox}}, {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}.
-- Load necessary modules.
require('Módulo:No globals')
local getArgs
-- local categoryHandler = require('Módulo:Category handler')._main▼
local yesno = require('Módulo:Yesno')
Liña 108:
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
Liña 121 ⟶ 123:
cat = string.format('[[Categoría:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
Liña 187 ⟶ 190:
self.name,
'^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$'
) or mw.ustring.match(
self.name,
'^[mM][oO][dE][lL][oO][%s_]*:[%s_]*(.*)$'
) or self.name
templateName = 'Modelo:' .. templateName
Liña 204 ⟶ 210:
local sect
if args.sect == '' then
sect = '
elseif type(args.sect) == 'string' then
sect = '
end
local issue = args.issue
Liña 248 ⟶ 254:
end
if talkTitle and talkTitle.exists then
local talkText = 'A
if talkArgIsTalkPage then
talkText = string.format(
'%s en [[%s|%s]].',
talkText,
talk,
Liña 258 ⟶ 264:
else
talkText = string.format(
'%s na [[%s#%s|conversa]].',
talkText,
talkTitle.prefixedText,
Liña 354 ⟶ 360:
catTitle = getTitleObject('Categoría:' .. catTitle)
if not catTitle or not catTitle.exists then
self:addCat(0, 'Wikipedia:Artigos con parámetro de data non válido nun modelo')
end
elseif mainCat and (not date or date == '') then
Liña 411 ⟶ 417:
if self.invalidTypeError then
local allSort = (self.title.namespace == 0 and 'Main:' or '') .. self.title.prefixedText
self:addCat('all', 'Wikipedia:Erros
end
if self.isSubstituted then
self:addCat('all', '
end
end
Liña 424 ⟶ 430:
self:setTemplateCategories()
end
end
--function MessageBox:renderCategories()
-- if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
-- return ""
-- end
-- Convert category tables to strings and pass them through
-- [[
-- main = table.concat(self.categories[0] or {}),
-- template = table.concat(self.categories[10] or {}),
-- all = table.concat(self.categories.all or {}),
-- nocat = self.args.nocat,
-- page = self.args.page
--end
function MessageBox:export()
Liña 551 ⟶ 563:
:css('text-align', 'center')
:wikitext(string.format(
'
self.type or ''
))
Liña 557 ⟶ 569:
-- Add categories.
return tostring(root)
Liña 585 ⟶ 597:
return function (frame)
if not getArgs then
getArgs = require('Módulo:
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))
|