Binding of Isaac: Rebirth Wiki
MannedTooth (discussion | contributions)
Aucun résumé des modifications
MannedTooth (discussion | contributions)
Aucun résumé des modifications
Ligne 175 : Ligne 175 :
 
local args = rtableau.toutRogner( rtableau.obtenirArgs( f ) )
 
local args = rtableau.toutRogner( rtableau.obtenirArgs( f ) )
 
local liste = require( 'Module:Image' ).separerParams( args[1] )
 
local liste = require( 'Module:Image' ).separerParams( args[1] )
local _r = require( 'Module:Text' ).font{ 'ID', list[1] }
+
local _r = require( 'Module:Text' ).font{ 'ID', liste[1] }
 
if args[2] == 'a' then
 
if args[2] == 'a' then
if list['a+'] then _r = f:expandTemplate{ title = 'dlc', args = { 'na+' } } .. _r .. '<br>' .. f:expandTemplate{ title = 'dlc', args = { 'a+' } } .. require( 'Module:Text' ).font{ 'ID', list['a+'] } end
+
if liste['a+'] then _r = f:expandTemplate{ title = 'dlc', args = { 'na+' } } .. _r .. '<br>' .. f:expandTemplate{ title = 'dlc', args = { 'a+' } } .. require( 'Module:Text' ).font{ 'ID', liste['a+'] } end
 
elseif args[2] == '0' then
 
elseif args[2] == '0' then
if list['a'] then _r = f:expandTemplate{ title = 'dlc', args = { 'na' } } .. _r .. '<br>' .. f:expandTemplate{ title = 'dlc', args = { 'a' } } .. require( 'Module:Text' ).font{ 'ID', list['a'] } end
+
if liste['a'] then _r = f:expandTemplate{ title = 'dlc', args = { 'na' } } .. _r .. '<br>' .. f:expandTemplate{ title = 'dlc', args = { 'a' } } .. require( 'Module:Text' ).font{ 'ID', liste['a'] } end
if list['a+'] then _r = _r .. '<br>' .. f:expandTemplate{ title = 'dlc', args = { 'a+' } } .. require( 'Module:Text' ).font{ 'ID', list['a+'] } end
+
if liste['a+'] then _r = _r .. '<br>' .. f:expandTemplate{ title = 'dlc', args = { 'a+' } } .. require( 'Module:Text' ).font{ 'ID', list['a+'] } end
 
end
 
end
 
return _r
 
return _r

Version du 24 janvier 2019 à 19:20

Missing No. Icon
Ce module est lié au projet Modèles.
Ne l'utilisez pas sur des pages du wiki non-liées à ce projet tant que celui-ci n'est pas terminé.



local p = {}
local rtableau = require( 'Module:Tableau' )
local rtext = require( 'Module:Text' )

function p.image( f )
	local args = rtext.trimAll( f.args )
	local text = ''
	local images = { 'a useless text', 'another useless text' }
	
	if args[3] ~= '' and args[3] ~= nil then
		images = mw.text.split( f.args[3], '%(' )
	end
	
	local m = 2
	if images[2] then repeat
		local _sS = args['sS'] or ''
		local _t = args[1]
		local _sE = args['sE'] or ''
		local _e = args['ext'] or '.png'
		local _s = args['size'] or ''
		local getSize = args['getsize']
		local _l = ''
		local _c = ''
		
		if args[3] ~= '' and args[3] ~= nil then
			local image = mw.text.split( mw.text.trim( mw.text.trim( images[m] ), '%)' ), ',%s' )
			local n = 1
			if image[1] then repeat
				local value = mw.text.split( mw.text.trim( image[n] ), ':' )
				value = rtext.trimAll( value )
				if value[1] == 'ext' then
					_e = value[2]
				elseif value[1] == 'size' then
					_s = value[2]
				elseif value[1] == 'getsize' then
					getSize = value[2]
				elseif value[1] == 'ss' then
					_sS = value[2]
				elseif value[1] == 'se' then
					_sE = value[2]
				elseif value[1] == 'name' then
					_t = value[2]
				else
					_c = _c .. '[[Catégorie:Paramètres d\'image inconnus]]'
				end
				n = n + 1
			until not image[n] end
		end
		
		if getSize then
			local fileTitle = mw.title.new( 'Image:' .. _sS .. _t .. _sE .. _e )
			local fileWidth = fileTitle.file.width * mw.text.trim( getSize, 'x' )
			local fileHeight = fileTitle.file.height * mw.text.trim( getSize, 'x' )
			_s = fileWidth .. 'x' .. fileHeight .. 'px'
		end
		if args['link'] then
			_l = args[1] .. '|' .. args[2]
		else
			_l = ''
		end
		text = text .. '[[Image:' .. _sS .. _t .. _sE .. _e .. '|' .. _s .. '|link=' .. _l .. ']]' .. _c
		m = m + 1
	until not images[m] end
	
	return text
end


function p.quote( f )
	local args = rtext.trimAll( f.args )
	local quote = args[1]
	local sentence
	local _c = ''
	
	if quote:find( 'vf' ) then
		sentence = mw.text.split( quote, '%)%s' )
		sentence[1] = mw.text.trim( sentence[1], 'vo%(' )
		sentence[2] = mw.text.trim( sentence[2], 'vf%(' )
		sentence[2] = mw.text.trim( sentence[2], '%)' )
		if args['italic'] then
			_c = "[[Fichier:Drapeau_EN.png|18px|lien=|Texte original]] ''\"" .. sentence[1] .. "\"''<br/>[[Fichier:Drapeau_FR.png|18px|lien=|Traduction française]] ''\"" .. sentence[2] .. "\"''"
		else
			_c = '[[Fichier:Drapeau_EN.png|18px|lien=|Texte original]] "' .. sentence[1] .. '"<br/>[[Fichier:Drapeau_FR.png|18px|lien=|Traduction française]] "' .. sentence[2] .. '"'
		end
	else
		sentence = mw.text.trim( quote, 'vo%(' )
		sentence = mw.text.trim( quote, '%)' )
		if args['italic'] then
			_c = "''\"" .. sentence .. "\"''"
		else
			_c = '"' .. sentence .. '"'
		end
	end
	
	return _c
end


function p.recharge( f )
	local args = mw.text.split( mw.text.trim( f.args[1] ), ',%s' )
	local _i = ''
	local imgParam
	
	if f.args['big'] then
		imgParam = '|15px|link='
	else
		imgParam = '|6px|link='
	end
	if args[1] == '1' then
		_i = '[[Image:Recharge_1.png' .. imgParam .. '|Recharge à 1 cran]]'
	elseif args[1] == '2' then
		_i = '[[Image:Recharge_2.png' .. imgParam .. '|Recharge à 2 crans]]'
	elseif args[1] == '3' then
		_i = '[[Image:Recharge_3.png' .. imgParam .. '|Recharge à 3 crans]]'
	elseif args[1] == '4' then
		_i = '[[Image:Recharge_4.png' .. imgParam .. '|Recharge à 4 crans]]'
	elseif args[1] == '6' then
		_i = '[[Image:Recharge_6.png' .. imgParam .. '|Recharge à 6 crans]]'
	elseif args[1] == '12' then
		_i = '[[Image:Recharge_12.png' .. imgParam .. '|Recharge à 12 crans]]'
	elseif args[1] == 'utilisation unique' then
		_i = '[[Image:Recharge_one_time.png' .. imgParam .. '|Utilisation unique]]'
	elseif args[1] == 'infinie' then
		_i = '[[Image:Recharge_unlimited.png' .. imgParam .. '|Infinie]]'
	elseif string.find( args[1], 's' ) then
		_i = '[[Image:Recharge_time.png' .. imgParam .. '|Recharge en ' .. mw.text.trim( args[1], 's' ) .. ' secondes]]'
	end
	
	if f.args['imageOnly'] then
		return _i
	else
		return _i .. ' &nbsp;' .. f.args[1]
	end
end


function p.collectionGrid( f )
	local args = rtext.trimAll( f.args )
	local pos = mw.text.split( mw.text.trim( f.args[1] ), '%s' )
	local column = tonumber( pos[2] )
	local line = tonumber( pos[3] )
	local _t = ''
	local _g = ''
	
	if f.args['text'] then
		_t = '\n(page ' .. pos[1] .. ', colonne ' .. pos[2] .. ', ligne ' .. pos[3] .. ')'
	end
	
	_g = '\n<table class="wikitable" style="margin:1em auto 1em auto; line-height:0">'
	
	for i=1, args['l'], 1 do
		if line == i then
			_g = _g .. '<tr style="background-color:#CCC">'
		else
			_g = _g .. '<tr>'
		end
		for j=1, args['c'], 1 do
			if column == j and line == i then
				_g = _g .. '<td style="background-color:#888"></td>'
			elseif column == j then
				_g = _g .. '<td style="background-color:#CCC"></td>'
			else
				_g = _g .. '<td></td>'
			end
		end
		_g = _g .. '</tr>'
	end
	
	_g = _g .. '</table>'
	
	return _t .. _g
end

function p.vie( f )
	local args = rtableau.toutRogner( rtableau.obtenirArgs( f ) )
	local liste = require( 'Module:Image' ).separerParams( args[1] )
	local _r = require( 'Module:Text' ).font{ 'ID', liste[1] }
	if args[2] == 'a' then
		if liste['a+'] then _r = f:expandTemplate{ title = 'dlc', args = { 'na+' } } .. _r .. '<br>' .. f:expandTemplate{ title = 'dlc', args = { 'a+' } } .. require( 'Module:Text' ).font{ 'ID', liste['a+'] } end
	elseif args[2] == '0' then
		if liste['a'] then _r = f:expandTemplate{ title = 'dlc', args = { 'na' } } .. _r .. '<br>' .. f:expandTemplate{ title = 'dlc', args = { 'a' } } .. require( 'Module:Text' ).font{ 'ID', liste['a'] } end
		if liste['a+'] then _r = _r .. '<br>' .. f:expandTemplate{ title = 'dlc', args = { 'a+' } } .. require( 'Module:Text' ).font{ 'ID', list['a+'] } end
	end
	return _r
end

return p