Minecraft Wiki
Advertisement
[Ver | Editar | Purgar]DocumentaciónVer código ↴

p.unsigned implements {{sin firmar}} and {{sin fechar}}.

Dependencies

[Ver | Editar | Purgar]La documentación arriba es transcluída desde Módulo:Unsigned/doc.
local p = {}
function base( args )
	local type = args.type or 'no firmado'
	local user = args.user
	local date = args.date
	if date and not date:find( '%(UTC%)$' ) then
		date = date .. ' (UTC)'
	end
	local nowiki = ''
	if mw.isSubsting() then
		nowiki = '<nowiki/>'
	end
	
	local text = {
		'<small>– Comentario ' ..  type  .. ' añadido ',
		'. Firme sus comentarios con ~~' .. nowiki .. '~~</small>'
	}
	if date then
		table.insert( text, 2, ' at ' .. date )
	end
	if user then
		local userLinks
		if not user:find( '[^:%x%.%d]' ) and require( 'Módulo:IPAddress' ).isIP( user ) then
			userLinks = '[[Special:Contribs/' .. user .. '|' .. user .. ']] ([[Usuario discusión:' .. user .. '|discusión]])'
		else
			userLinks = '[[Usuario:' .. user .. '|' .. user .. ']] ([[Usuario discusión:' .. user .. '|discusión]] • [[Special:Contribs/' .. user .. '|contribuciones]])'
		end
		table.insert( text, 2, ' by ' .. userLinks )
	end

	return table.concat( text )
end

p.unsigned = function( f )
	local args = require( 'Module:ProcessArgs' ).norm( f.args or f )
	local type = args.type or 'no firmado'
	local user = args.user
	local date = args.date
	
	local category = { '<!-- Plantilla:' .. type .. ' -->' }
	if mw.isSubsting() then
		-- Don't allow substitution with missing required arg
		if type == 'no firmado' and not user then
			local dateArg = ''
			if date then
				dateArg = '||' .. date
			end
			return '{{Sin firmar' .. dateArg .. '}}'
		elseif type == 'sin fechar' and not date then
			return '{{Sin fechar}}'
		end
	elseif mw.title:getCurrentTitle().namespace ~= 10 then
		if type == 'no firmado' and not user then
			table.insert( category, '[[Categoría:Plantilla no firmada usada incorrectamente]]' )
		elseif type == 'sin fechar' and not date then
			table.insert( category, '[[Categoría:Plantilla no fechada usada incorrectamente]]' )
		end
		table.insert( category, '[[Categoría:Páginas con plantillas requiriendo sustitución]]' )
	end
	
	return base( args ) .. table.concat( category )
end

return p
Advertisement