Módulo:Message box: Diferenzas entre revisións

Contido eliminado Contido engadido
Banjo (conversa | contribucións)
Sen resumo de edición
Banjo (conversa | contribucións)
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 = 'ThisEsta ' .. (cfg.sectionDefault or 'pagepáxina')
elseif type(args.sect) == 'string' then
sect = 'ThisEsta ' .. args.sect
end
local issue = args.issue
Liña 248 ⟶ 254:
end
if talkTitle and talkTitle.exists then
local talkText = 'A discusiónconversa relevanterelativa a isto pode atoparse na'
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 messageen boxparámetros parameterde needsmessage fixingbox', allSort)
end
if self.isSubstituted then
self:addCat('all', 'PagesWikipedia:Páxinas withcon incorrectlyerros substitutedde templatessubstitución de modelos')
end
end
Liña 424 ⟶ 430:
self:setTemplateCategories()
end
--self:setAllNamespaceCategories()
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
-- [[MóduloModule:Category handler]].
-- local categoryHandler = return require('MóduloModule:Category handler')._main{
return categoryHandler{
-- 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(
'EstaEste caixamessage debox avisoestá usaa usar un parámetro non válido "type=%s" none válidoprecisa un arranxo.',
self.type or ''
))
Liña 557 ⟶ 569:
 
-- Add categories.
-- root:wikitext(self:renderCategories() or nil)
 
return tostring(root)
Liña 585 ⟶ 597:
return function (frame)
if not getArgs then
getArgs = require('Módulo:ArgumentsArgumentos').getArgs
end
return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))