Aller au contenu

Poképédia subit actuellement quelques soucis techniques !
L'équipe est au courant des problèmes et fait le nécessaire pour les arranger le plus rapidement possible. Merci de votre compréhension !

Module:Infobox Pokémon/wb

De Poképédia

La documentation pour ce module peut être créée à Module:Infobox Pokémon/wb/doc

local p = {}

local PROPRIETES = {
	premier_type = 'P1',
	second_type = 'P2',
	categorie = 'P10',
	apparence_corps = 'P125',
	contexte_numerotation = 'P127',
	couleur = 'P14',
	eclosion = 'P42',
	exp_niveau_100 = 'P44',
	fmratio = 'P134',
	forme_pokemon = 'P129',
	generation = 'P51',
	generation_concernee = 'P136',
	groupe_oeuf = 'P124',
	condition_affichage = 'P135',
	nom_depose = 'P130',
	nom_romaji = 'P131',
	talent = 'P132',
	type_talent = 'P133',
	numero_dex_regional = 'P126',
	numero_national = 'P69',
	numero_secondaire = 'P128',
	poids = 'P75',
	points_effort = 'P76',
	points_exp = 'P77',
	taille = 'P105',
	taux_capture = 'P106',
}

local GENERATIONS_WIKIBASE = {
	['Première génération'] = '1',
	['Deuxième génération'] = '2',
	['Troisième génération'] = '3',
	['Quatrième génération'] = '4',
	['Cinquième génération'] = '5',
	['Sixième génération'] = '6',
	['Septième génération'] = '7',
	['Huitième génération'] = '8',
	['Neuvième génération'] = '9',
	['Dixième génération'] = '10',
}

local GENERATION_COURANTE = 9

local APPARENCES_DU_CORPS_WIKIBASE = {
	["Constitué uniquement d'une tête"] = '1',
	['Corps serpentin'] = '2',
	['Dispose de nageoires'] = '3',
	["Constitué d'une tête et de bras"] = '4',
	["Constitué d'une tête et d'un corps"] = '5',
	["Bipède disposant d'une queue"] = '6',
	["Constitué d'une tête et de jambes"] = '7',
	['Quadrupède'] = '8',
	["Dispose d'une seule paire d'ailes"] = '9',
	['Dispose de tentacules ou de multiples pattes'] = '10',
	['Corps multiple'] = '11',
	['Bipède sans queue'] = '12',
	["Dispose de deux paires d'ailes"] = '13',
	['Corps insectoïde'] = '14',
}

local CONTEXTES_DEX_REGIONAUX = {
	['Kanto'] = 1,
	['Kanto-LGPE'] = 2,
	['Johto'] = 3,
	['Johto-HGSS'] = 4,
	['Hoenn'] = 5,
	['Hoenn-ROSA'] = 6,
	['Sinnoh'] = 7,
	['Sinnoh-Pt'] = 8,
	['Unys'] = 9,
	['Unys-N2B2'] = 10,
	['Kalos (Centre)'] = 11,
	['Kalos (Côtes)'] = 12,
	['Kalos (Monts)'] = 13,
	['Alola'] = 14,
	['Alola-USUL'] = 15,
	['Galar'] = 16,
	['Isolarmure'] = 17,
	['Couronneige'] = 18,
	['Hisui'] = 19,
	['Paldea'] = 20,
	['Septentria'] = 21,
	['Myrtille'] = 22,
	['Illumis'] = 23,
	['Extra Illumis'] = 24,
}

local CONTEXTES_DEX_SECONDAIRES = {
	['Fiore'] = 1,
	['Almia'] = 2,
	['Oblivia (Présent)'] = 3,
	['Oblivia (Passé)'] = 4,
	['Ransei'] = 5,
	['Ransei (Reshiram)'] = 6,
	['PokéPark'] = 7,
	['PokéPark 2'] = 8,
	['Google Maps'] = 9,
	['Shuffle'] = 10,
	['Picross'] = 11,
	['Picross (Alternatif)'] = 12,
	['Lentis'] = 13,
	['Pokopia'] = 14,
	['Pokopia (Évènements)'] = 15,
}

local function non_vide( valeur )
	return valeur ~= nil and mw.text.trim( tostring( valeur ) ) ~= ""
end

local function get_entity_from_args( args )
	if not mw.wikibase then
		return nil
	end

	if non_vide( args['item'] ) then
		return mw.wikibase.getEntity( mw.text.trim( args['item'] ) )
	end

	return mw.wikibase.getEntity()
end

local function get_statement_value( statement )
	if not statement or not statement.mainsnak then
		return nil
	end

	if statement.mainsnak.snaktype ~= 'value' or not statement.mainsnak.datavalue then
		return nil
	end

	return statement.mainsnak.datavalue.value
end

local function get_best_statement_value( entity, property_id )
	if not entity or not property_id then
		return nil
	end

	local statements = entity:getBestStatements( property_id )
	if not statements or not statements[1] then
		return nil
	end

	return get_statement_value( statements[1] )
end

local function get_entity_label( entity, language_code )
	if not entity or type( entity.labels ) ~= 'table' or not non_vide( language_code ) then
		return nil
	end

	local label = entity.labels[language_code]
	if type( label ) == 'table' and non_vide( label.value ) then
		return label.value
	end

	return nil
end

local function get_string_value_from_entity( entity, property_id )
	local value = get_best_statement_value( entity, property_id )

	if type( value ) == 'string' then
		return value
	end

	if type( value ) == 'table' and value.id and mw.wikibase.getLabel then
		return mw.wikibase.getLabel( value.id )
	end

	return nil
end

local function get_string_value_from_statement( statement )
	local value = get_statement_value( statement )

	if type( value ) == 'string' then
		return value
	end

	if type( value ) == 'table' and value.id and mw.wikibase.getLabel then
		return mw.wikibase.getLabel( value.id )
	end

	return nil
end

local function get_quantity_value_from_entity( entity, property_id )
	local value = get_best_statement_value( entity, property_id )

	if type( value ) ~= 'table' or type( value.amount ) ~= 'string' then
		return nil
	end

	local amount = value.amount:gsub( '^%+', '' )
	amount = amount:gsub( '%.0+$', '' )
	return amount
end

local function get_quantity_value_from_statement( statement )
	local value = get_statement_value( statement )

	if type( value ) ~= 'table' or type( value.amount ) ~= 'string' then
		return nil
	end

	local amount = value.amount:gsub( '^%+', '' )
	amount = amount:gsub( '%.0+$', '' )
	return amount
end

local function get_fmratio_value_from_statement( statement )
	if not statement or not statement.mainsnak then
		return nil
	end

	if statement.mainsnak.snaktype == 'novalue' then
		return '-1'
	end

	return get_quantity_value_from_statement( statement )
end

local function get_item_labels_from_entity( entity, property_id, dedupe )
	if not entity or not property_id then
		return nil
	end

	local statements = entity:getBestStatements( property_id )
	if not statements then
		return nil
	end

	local labels = {}
	local deja_vu = {}

	for _, statement in ipairs( statements ) do
		local value = get_statement_value( statement )
		if type( value ) == 'table' and value.id and mw.wikibase.getLabel then
			local label = mw.wikibase.getLabel( value.id )
			if non_vide( label ) and ( not dedupe or not deja_vu[label] ) then
				table.insert( labels, label )
				deja_vu[label] = true
			end
		end
	end

	if labels[1] then
		return labels
	end

	return nil
end

local function get_item_qualifier_label( statement, property_id )
	if not statement or not statement.qualifiers or not statement.qualifiers[property_id] then
		return nil
	end

	for _, qualifier in ipairs( statement.qualifiers[property_id] ) do
		if qualifier.snaktype == 'value' and qualifier.datavalue then
			local value = qualifier.datavalue.value
			if type( value ) == 'table' and value.id and mw.wikibase.getLabel then
				local label = mw.wikibase.getLabel( value.id )
				if non_vide( label ) then
					return label
				end
			end
		end
	end

	return nil
end

local function get_item_qualifier_labels( statement, property_id )
	if not statement or not statement.qualifiers or not statement.qualifiers[property_id] then
		return nil
	end

	local labels = {}
	local deja_vu = {}

	for _, qualifier in ipairs( statement.qualifiers[property_id] ) do
		if qualifier.snaktype == 'value' and qualifier.datavalue then
			local value = qualifier.datavalue.value
			if type( value ) == 'table' and value.id and mw.wikibase.getLabel then
				local label = mw.wikibase.getLabel( value.id )
				if non_vide( label ) and not deja_vu[label] then
					table.insert( labels, label )
					deja_vu[label] = true
				end
			end
		end
	end

	if labels[1] then
		return labels
	end

	return nil
end

local function get_string_qualifier_value( statement, property_id )
	if not statement or not statement.qualifiers or not statement.qualifiers[property_id] then
		return nil
	end

	for _, qualifier in ipairs( statement.qualifiers[property_id] ) do
		if qualifier.snaktype == 'value' and qualifier.datavalue then
			local value = qualifier.datavalue.value
			if type( value ) == 'string' and non_vide( value ) then
				return value
			end
		end
	end

	return nil
end

local function normalize_form_label( label )
	if not non_vide( label ) then
		return nil
	end

	local parenthetical = mw.ustring.match( label, '^.-%((.-)%)$' )
	if non_vide( parenthetical ) then
		return parenthetical
	end

	return label
end

local function get_form_labels( statement )
	local qualifier_labels = get_item_qualifier_labels( statement, PROPRIETES.forme_pokemon )
	if not qualifier_labels then
		return nil
	end

	local labels = {}
	local deja_vu = {}

	for _, qualifier_label in ipairs( qualifier_labels ) do
		local normalized_label = normalize_form_label( qualifier_label )
		if non_vide( normalized_label ) and not deja_vu[normalized_label] then
			table.insert( labels, normalized_label )
			deja_vu[normalized_label] = true
		end
	end

	if labels[1] then
		return labels
	end

	return nil
end

local function get_generation_numbers( statement )
	local labels = get_item_qualifier_labels( statement, PROPRIETES.generation_concernee )
	if not labels then
		return nil
	end

	local numbers = {}
	local deja_vu = {}

	for _, label in ipairs( labels ) do
		local generation = tonumber( GENERATIONS_WIKIBASE[label] )
		if generation == nil then
			return nil
		end
		if not deja_vu[generation] then
			table.insert( numbers, generation )
			deja_vu[generation] = true
		end
	end

	table.sort( numbers )

	if numbers[1] then
		return numbers
	end

	return nil
end

local function serialize_generation_note( numbers )
	if type( numbers ) ~= 'table' or not numbers[1] then
		return nil
	end

	local first = numbers[1]
	local last = numbers[#numbers]
	local contiguous = true

	for i = 2, #numbers do
		if numbers[i] ~= numbers[i - 1] + 1 then
			contiguous = false
			break
		end
	end

	if contiguous then
		if #numbers == 1 then
			return 'génération ' .. tostring( first )
		end
		if last == GENERATION_COURANTE then
			return 'depuis la génération ' .. tostring( first )
		end
		return 'générations ' .. tostring( first ) .. ' à ' .. tostring( last )
	end

	if #numbers == 2 then
		return 'générations ' .. tostring( numbers[1] ) .. ' et ' .. tostring( numbers[2] )
	end

	local parts = {}
	for i, number in ipairs( numbers ) do
		parts[i] = tostring( number )
	end

	local last_part = table.remove( parts )
	return 'générations ' .. table.concat( parts, ', ' ) .. ' et ' .. last_part
end

local function arg_has_numbering_notes( arg_value )
	if not non_vide( arg_value ) then
		return false
	end

	local entries = mw.text.split( arg_value, '//' )

	for _, entry in ipairs( entries ) do
		local parts = mw.text.split( entry, '/' )
		if non_vide( parts[3] ) then
			return true
		end
	end

	return false
end

local function get_numbering_or_arg( entity, property_id, arg_value, expected_contexts )
	if arg_has_numbering_notes( arg_value ) then
		return arg_value
	end

	if not entity or not property_id or not expected_contexts then
		return arg_value
	end

	local statements = entity:getBestStatements( property_id )
	if not statements or not statements[1] then
		return arg_value
	end

	local entries = {}
	local tie_breaker = 1

	for _, statement in ipairs( statements ) do
		local value = get_statement_value( statement )
		local contexte = get_item_qualifier_label( statement, PROPRIETES.contexte_numerotation )

		if not non_vide( value ) or not non_vide( contexte ) or not expected_contexts[contexte] then
			return arg_value
		end

		table.insert( entries, {
			contexte = contexte,
			numero = value,
			ordre = expected_contexts[contexte],
			tie_breaker = tie_breaker,
		} )
		tie_breaker = tie_breaker + 1
	end

	if not entries[1] then
		return arg_value
	end

	table.sort( entries, function( left, right )
		if left.ordre == right.ordre then
			return left.tie_breaker < right.tie_breaker
		end

		return left.ordre < right.ordre
	end )

	local serialized = {}

	for _, entry in ipairs( entries ) do
		table.insert( serialized, entry.contexte .. '/' .. entry.numero )
	end

	return table.concat( serialized, '//' )
end

local function get_wikibase_or_arg( entity, property_id, arg_value, data_type )
	if type( arg_value ) == 'string' and string.find( arg_value, '/', 1, true ) then
		-- Keep article-local multi-form or conditional values until the item model can express them.
		return arg_value
	end

	local wikibase_value

	if data_type == 'quantity' then
		wikibase_value = get_quantity_value_from_entity( entity, property_id )
	else
		wikibase_value = get_string_value_from_entity( entity, property_id )
	end

	if non_vide( wikibase_value ) then
		return wikibase_value
	end

	return arg_value
end

local function get_form_qualified_or_arg( entity, property_id, arg_value, conditions_list, data_type )
	if not entity or not property_id then
		return arg_value
	end

	local statements = entity:getBestStatements( property_id )
	if not statements or not statements[1] then
		return arg_value
	end

	local any_form = false
	local values_by_form = {}

	for _, statement in ipairs( statements ) do
		local form_labels = get_form_labels( statement )
		local value

		if data_type == 'quantity' then
			value = get_quantity_value_from_statement( statement )
		else
			value = get_string_value_from_statement( statement )
		end

		if not non_vide( value ) then
			return arg_value
		end

		if form_labels and form_labels[1] then
			any_form = true
			for _, form_label in ipairs( form_labels ) do
				if non_vide( values_by_form[form_label] ) and values_by_form[form_label] ~= value then
					return arg_value
				end
				values_by_form[form_label] = value
			end
		elseif #statements > 1 or ( type( arg_value ) == 'string' and string.find( arg_value, '/', 1, true ) ) then
			return arg_value
		end
	end

	if not any_form then
		return get_wikibase_or_arg( entity, property_id, arg_value, data_type )
	end

	if type( conditions_list ) ~= 'table' or not non_vide( conditions_list[1] ) then
		return arg_value
	end

	local serialized = {}

	for _, condition in ipairs( conditions_list ) do
		if not non_vide( condition ) or not non_vide( values_by_form[condition] ) then
			return arg_value
		end
		table.insert( serialized, values_by_form[condition] )
	end

	return table.concat( serialized, '/' )
end

local function get_generation_qualified_quantity_or_arg( entity, property_id, arg_value )
	if not entity or not property_id then
		return arg_value
	end

	local statements = entity:getBestStatements( property_id )
	if not statements or not statements[1] then
		return arg_value
	end

	local entries = {}
	local any_generation = false

	for _, statement in ipairs( statements ) do
		local value = get_quantity_value_from_statement( statement )
		if not non_vide( value ) then
			return arg_value
		end

		local generation_numbers = get_generation_numbers( statement )
		local note = serialize_generation_note( generation_numbers )

		if generation_numbers and generation_numbers[1] then
			any_generation = true
		elseif #statements > 1 then
			return arg_value
		end

		table.insert( entries, {
			value = value,
			note = note,
			sort_generation = generation_numbers and generation_numbers[1] or 999,
		} )
	end

	if not any_generation then
		return get_wikibase_or_arg( entity, property_id, arg_value, 'quantity' )
	end

	table.sort( entries, function( left, right )
		if left.sort_generation == right.sort_generation then
			return tonumber( left.value ) < tonumber( right.value )
		end
		return left.sort_generation < right.sort_generation
	end )

	local serialized = {}
	for _, entry in ipairs( entries ) do
		if non_vide( entry.note ) then
			table.insert( serialized, entry.value .. '/' .. entry.note )
		else
			table.insert( serialized, entry.value )
		end
	end

	return table.concat( serialized, '//' )
end

local function get_talents_or_arg( entity, arg_value, conditions_list )
	if not entity or not PROPRIETES.talent then
		return arg_value
	end

	local statements = entity:getBestStatements( PROPRIETES.talent )
	if not statements or not statements[1] then
		return arg_value
	end

	local any_form = false
	local talents_by_form = {}
	local talents_without_form = {}

	for _, statement in ipairs( statements ) do
		local talent_name = get_string_value_from_statement( statement )
		if not non_vide( talent_name ) then
			return arg_value
		end

		local talent_type = get_string_qualifier_value( statement, PROPRIETES.type_talent )
		local serialized_talent = talent_name
		if non_vide( talent_type ) then
			serialized_talent = serialized_talent .. '/' .. talent_type
		end

		local form_labels = get_form_labels( statement )
		if form_labels and form_labels[1] then
			any_form = true
			for _, form_label in ipairs( form_labels ) do
				if not talents_by_form[form_label] then
					talents_by_form[form_label] = {}
				end
				table.insert( talents_by_form[form_label], serialized_talent )
			end
		else
			table.insert( talents_without_form, serialized_talent )
		end
	end

	if not any_form then
		if talents_without_form[1] then
			return table.concat( talents_without_form, '//' )
		end
		return arg_value
	end

	if talents_without_form[1] then
		return arg_value
	end

	if type( conditions_list ) ~= 'table' or not non_vide( conditions_list[1] ) then
		return arg_value
	end

	local serialized_groups = {}
	local used_forms = {}

	for _, condition in ipairs( conditions_list ) do
		if not non_vide( condition ) or not talents_by_form[condition] or not talents_by_form[condition][1] then
			return arg_value
		end

		table.insert( serialized_groups, table.concat( talents_by_form[condition], '//' ) )
		used_forms[condition] = true
	end

	for form_label, talents_for_form in pairs( talents_by_form ) do
		if talents_for_form[1] and not used_forms[form_label] then
			return arg_value
		end
	end

	return table.concat( serialized_groups, '///' )
end

local function get_fmratio_or_arg( entity, arg_value, conditions_list )
	if not entity or not PROPRIETES.fmratio then
		return arg_value
	end

	local statements = entity:getBestStatements( PROPRIETES.fmratio )
	if not statements or not statements[1] then
		return arg_value
	end

	local any_form = false
	local values_by_form = {}
	local standalone_value = nil

	for _, statement in ipairs( statements ) do
		local form_labels = get_form_labels( statement )
		local value = get_fmratio_value_from_statement( statement )

		if not non_vide( value ) then
			return arg_value
		end

		if form_labels and form_labels[1] then
			any_form = true
			for _, form_label in ipairs( form_labels ) do
				if non_vide( values_by_form[form_label] ) and values_by_form[form_label] ~= value then
					return arg_value
				end
				values_by_form[form_label] = value
			end
		elseif #statements > 1 or ( type( arg_value ) == 'string' and string.find( arg_value, '/', 1, true ) ) then
			return arg_value
		else
			standalone_value = value
		end
	end

	if not any_form then
		if non_vide( standalone_value ) then
			return standalone_value
		end
		return arg_value
	end

	if type( conditions_list ) ~= 'table' or not non_vide( conditions_list[1] ) then
		return arg_value
	end

	local serialized = {}

	for _, condition in ipairs( conditions_list ) do
		if not non_vide( condition ) or not non_vide( values_by_form[condition] ) then
			return arg_value
		end
		table.insert( serialized, values_by_form[condition] )
	end

	return table.concat( serialized, '/' )
end

local function get_egg_groups_or_args( entity, groupeoeuf1, groupeoeuf2, groupeoeuf1diff, groupeoeuf2diff )
	if entity and PROPRIETES.groupe_oeuf then
		local statements = entity:getBestStatements( PROPRIETES.groupe_oeuf )
		local labels = {}
		local diffs = {}

		if statements then
			for _, statement in ipairs( statements ) do
				local value = get_statement_value( statement )
				if type( value ) == 'table' and value.id and mw.wikibase.getLabel then
					local label = mw.wikibase.getLabel( value.id )
					if non_vide( label ) then
						table.insert( labels, label )
						table.insert( diffs, get_string_qualifier_value( statement, PROPRIETES.condition_affichage ) )
					end
				end
			end
		end

		if labels[1] then
			return labels[1], diffs[1], labels[2], diffs[2]
		end
	end

	return groupeoeuf1, groupeoeuf1diff, groupeoeuf2, groupeoeuf2diff
end

local function get_body_shapes_or_args( entity, corps, forme )
	if not non_vide( corps ) then
		corps = forme
	end

	local body_shapes = get_item_labels_from_entity( entity, PROPRIETES.apparence_corps, false )
	if not body_shapes or not body_shapes[1] then
		return corps
	end

	local codes = {}

	for _, label in ipairs( body_shapes ) do
		local code = APPARENCES_DU_CORPS_WIKIBASE[label]
		if not non_vide( code ) then
			return corps
		end
		table.insert( codes, code )
	end

	return table.concat( codes, '/' )
end

function separate_thousands(amount)
	local formatted = amount
	while true do
		formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1 %2')
		if (k==0) then
			break
		end
	end
	return formatted
end

-- remplace le point des decimales par une virgule dans une chaine, et ajoute une décimale quand il n'y en a pas
function decimal_dot_to_comma(str)
	if string.find(str, '%.')
	then return string.gsub(str,'%.',',')
	else return str .. ',0'
	end
end

-- convertit en nombre de pieds
function meters_to_feet_and_inches(str)
	local conversion = (tonumber(str) * 3.2808)
	return {feet = math.floor(conversion + 1/24), inches = math.floor((conversion - math.floor(conversion + 1/24)) * 12 + 0.5)}
end

-- convertit en nombre de livres
function kg_to_pounds(str)
	return math.floor((tonumber(str) * 2.2046)*10+0.5)/10
end

function nil_to_string(str)
	if str == nil
	then return ''
	else return str
	end
end

function association_region(frame, region)
	-- Jeux principaux

	if region == 'Kanto'					then return "[[Liste des Pokémon dans l'ordre du Pokédex de Kanto|Kanto]]"
	elseif region == 'Kanto-LGPE'			then return "[[Liste des Pokémon dans l'ordre du Pokédex de Kanto|Kanto]]" .. frame:expandTemplate{title='Sup', args={'LGPE'}}
	elseif region == 'Johto'				then return "[[Liste des Pokémon dans l'ordre du Pokédex de Johto|Johto]]" .. frame:expandTemplate{title='Sup', args={'OAC'}}
	elseif region == 'Johto-HGSS'			then return "[[Liste des Pokémon dans l'ordre du Pokédex de Johto (Pokémon Or HeartGold et Argent SoulSilver)|Johto]]" .. frame:expandTemplate{title='Sup', args={'HGSS'}}
	elseif region == 'Hoenn'				then return "[[Liste des Pokémon dans l'ordre du Pokédex de Hoenn|Hoenn]]" .. frame:expandTemplate{title='Sup', args={'RSE'}}
	elseif region == 'Hoenn-ROSA'			then return "[[Liste des Pokémon dans l'ordre du Pokédex de Hoenn (Pokémon Rubis Oméga et Saphir Alpha)|Hoenn]]" .. frame:expandTemplate{title='Sup', args={'ROSA'}}
	elseif region == 'Sinnoh'				then return "[[Liste des Pokémon dans l'ordre du Pokédex de Sinnoh|Sinnoh]]"
	elseif region == 'Sinnoh-Pt'			then return "[[Liste des Pokémon dans l'ordre du Pokédex de Sinnoh|Sinnoh]]" .. frame:expandTemplate{title='Sup', args={'Pt'}}
	elseif region == 'Unys'					then return "[[Liste des Pokémon dans l'ordre du Pokédex d'Unys|Unys]]" .. frame:expandTemplate{title='Sup', args={'NB'}}
	elseif region == 'Unys-N2B2'			then return "[[Liste des Pokémon dans l'ordre du Pokédex d'Unys (Pokémon Noir 2 et Blanc 2)|Unys]]" .. frame:expandTemplate{title='Sup', args={'N2B2'}}
	elseif region == 'Kalos (Centre)'		then return "[[Liste des Pokémon dans l'ordre du Pokédex de Kalos|Kalos]]<br/><small>(Centre)</small>"
	elseif region == 'Kalos (Côtes)'		then return "[[Liste des Pokémon dans l'ordre du Pokédex de Kalos|Kalos]]<br/><small>(Côtes)</small>"
	elseif region == 'Kalos (Monts)'		then return "[[Liste des Pokémon dans l'ordre du Pokédex de Kalos|Kalos]]<br/><small>(Monts)</small>"
	elseif region == 'Alola'				then return "[[Liste des Pokémon dans l'ordre du Pokédex d'Alola|Alola]]" .. frame:expandTemplate{title='Sup', args={'SL'}}
	elseif region == 'Alola-USUL'			then return "[[Liste des Pokémon dans l'ordre du Pokédex d'Alola (Pokémon Ultra-Soleil et Ultra-Lune)|Alola]]" .. frame:expandTemplate{title='Sup', args={'USUL'}}
	elseif region == 'Galar'				then return "[[Liste des Pokémon dans l'ordre du Pokédex de Galar|Galar]]"
	elseif region == 'Isolarmure'			then return "[[Liste des Pokémon dans l'ordre du Pokédex d'Isolarmure|Isolarmure]]"
	elseif region == 'Couronneige'			then return "[[Liste des Pokémon dans l'ordre du Pokédex de Couronneige|Couronneige]]"
	elseif region == 'Hisui'				then return "[[Liste des Pokémon dans l'ordre du Pokédex de Hisui|Hisui]]"
	elseif region == 'Paldea'				then return "[[Liste des Pokémon dans l'ordre du Pokédex de Paldea|Paldea]]"
	elseif region == 'Septentria'			then return "[[Liste des Pokémon dans l'ordre du Pokédex de Septentria|Septentria]]"
	elseif region == 'Myrtille'		    	then return "[[Liste des Pokémon dans l'ordre du Pokédex Myrtille|Myrtille]]"
	elseif region == 'Illumis'				then return "[[Liste des Pokémon dans l'ordre du Pokédex d'Illumis|Illumis]]"
	elseif region == 'Extra Illumis'		then return "[[Liste des Pokémon dans l'ordre du Pokédex d'Extra Illumis|Extra Illumis]]"

	-- Jeux secondaires

	elseif region == 'Fiore'				then return "[[Liste des Pokémon dans l'ordre du Navigateur de Fiore|Fiore]]"
	elseif region == 'Almia'				then return "[[Liste des Pokémon dans l'ordre du Navigateur d'Almia|Almia]]"
	elseif region == 'Oblivia (Présent)'	then return "[[Liste des Pokémon dans l'ordre du Navigateur d'Oblivia (Présent)|Oblivia]]<br/><small>(Présent)</small>"
	elseif region == 'Oblivia (Passé)'		then return "[[Liste des Pokémon dans l'ordre du Navigateur d'Oblivia (Passé)|Oblivia]]<br/><small>(Passé)</small>"
	elseif region == 'Ransei'				then return "[[Liste des Pokémon de la région de Ransei|Ransei]]"
	elseif region == 'Ransei (Reshiram)'	then return "[[Liste des Pokémon de la région de Ransei|Ransei]]<br/><small>(DLC Reshiram)</small>"
	elseif region == 'PokéPark'				then return "[[Liste des Pokémon de PokéPark Wii : La Grande Aventure de Pikachu|PokéPark]]"
	elseif region == 'PokéPark 2'			then return "[[Liste des Pokémon de PokéPark 2 : Le Monde des Vœux|PokéPark 2]]"
	elseif region == 'Google Maps'			then return "[[Liste des Pokémon dans l'ordre du Pokédex de Google Maps: Pokémon Challenge|Google Maps:<br/><small>Pokémon Challenge]]</small>"
	elseif region == 'Shuffle'				then return "[[Liste des Pokémon dans l'ordre du Pokédex de Pokémon Shuffle|Shuffle]]"
	elseif region == 'Picross'				then return "[[Liste des niveaux de Pokémon Picross|Picross]]"
	elseif region == 'Picross (Alternatif)'	then return "[[Liste des niveaux de Pokémon Picross|Picross]]<br/><small>(Alternatif)</small>"
	elseif region == 'Lentis'				then return "[[Liste des Pokémon dans l'ordre du Photodex|Lentis]]"
	elseif region == 'Pokopia'				then return "[[Liste des Pokémon dans l'ordre du Pokédex de Pokémon Pokopia|Pokopia]]"
	elseif region == 'Pokopia (Évènements)'	then return "[[Liste des Pokémon dans l'ordre du Pokédex de Pokémon Pokopia#Pokédex (évènements)|Pokopia]]<br/><small>(Évènements)</small>"
	else return '<i>' .. region .. '</i>'
	end
end

function Set (list)
  local set = {}
  for _, l in ipairs(list) do set[l] = true end
  return set
end

local regions_navigateur = Set {'Fiore', 'Almia', 'Oblivia (Présent)', 'Oblivia (Passé)'}

function p.infobox(frame)
	local resultat = {}
	local entity = get_entity_from_args( frame.args )

	local debug_mode = frame.args['debug']
	debug_mode = (debug_mode == "oui")

	local nom = frame.args['nom']
	if not non_vide( nom ) then nom = get_entity_label( entity, 'fr' ) end
	if not non_vide( nom ) then nom = frame:getParent():getTitle() end
	local nom_anglais = frame.args['nom-anglais']
	if not non_vide( nom_anglais ) then nom_anglais = get_entity_label( entity, 'en' ) end
	if not non_vide( nom_anglais ) then nom_anglais = '<i>Information manquante</i>' end
	local nom_japonais = frame.args['nom-japonais']
	if not non_vide( nom_japonais ) then nom_japonais = get_entity_label( entity, 'ja' ) end
	local nom_romaji = frame.args['nom-romaji']
	nom_romaji = get_wikibase_or_arg( entity, PROPRIETES.nom_romaji, nom_romaji, 'string' )
	local nom_depose = frame.args['nom-déposé']
	nom_depose = get_wikibase_or_arg( entity, PROPRIETES.nom_depose, nom_depose, 'string' )
	if not non_vide( nom_depose )
	then if not (nom_romaji == nil or nom_romaji == '')
		then nom_depose = nom_romaji
			nom_romaji = ''
		end
	end
	local artwork = frame.args['artwork']
	if artwork == nil or artwork == '' then artwork = nom end
	artwork = mw.text.split(artwork, "/")
	local forme_principale = frame.args['forme-principale']

	local legende = frame.args['légende']

	local type1 = frame.args['type1']
	type1 = get_wikibase_or_arg( entity, PROPRIETES.premier_type, type1, 'string' )
	if type1 == nil or type1 == '' then type1 = "inconnu" end
	type1 = mw.text.split(type1, "/")
	local type2 = frame.args['type2']
	type2 = get_wikibase_or_arg( entity, PROPRIETES.second_type, type2, 'string' )
	if type2 == '' or type2 == '-' or type2 == nil then type2 = {} else type2 = mw.text.split(type2, "/") end --on accepte que type2 soit nil
	local switch_artworks = frame.args['switch-artworks'] == 'oui'

	local ndex = frame.args['ndex']
	ndex = get_wikibase_or_arg( entity, PROPRIETES.numero_national, ndex, 'string' )
	if ndex == nil or ndex == '' then ndex = "—" end

	-- Temporaire
	local force_ndex = frame.args['force-ndex']
	force_ndex = true -- force_ndex == 'oui'

	local dex = frame.args['dex']
	local dex_secondaires = frame.args['dex-secondaires']
	dex = get_numbering_or_arg( entity, PROPRIETES.numero_dex_regional, dex, CONTEXTES_DEX_REGIONAUX )
	dex_secondaires = get_numbering_or_arg( entity, PROPRIETES.numero_secondaire, dex_secondaires, CONTEXTES_DEX_SECONDAIRES )
	-- The Wikibase fork renders the infobox but does not emit SMW inline annotations.
	local donnees = false
	local donnee_semantique_ndex = false
	local categories_wiki = frame.args['catégories-wiki']
	if categories_wiki
	then categories_wiki = categories_wiki ~= 'non'
	else local namespace = frame:preprocess("{{NAMESPACENUMBER}}")
		categories_wiki = (tonumber(namespace) == 0)
	end

	local categorisation_plusieurs_formes = frame.args['catégorisation-plusieurs-formes']
	categorisation_plusieurs_formes = categorisation_plusieurs_formes ~= 'non'
	local generation = frame.args['génération']
	if not non_vide( generation ) then
		local generation_wikibase = get_string_value_from_entity( entity, PROPRIETES.generation )
		generation = GENERATIONS_WIKIBASE[generation_wikibase]
	end

	generation = tonumber(generation)
	if generation == nil
	then local ndex_int = tonumber(ndex)
		if ndex_int
		then if ndex_int <= 151 then generation = 1
			elseif ndex_int <= 251 then generation = 2
			elseif ndex_int <= 386 then generation = 3
			elseif ndex_int <= 493 then generation = 4
			elseif ndex_int <= 649 then generation = 5
			elseif ndex_int <= 721 then generation = 6
			elseif ndex_int <= 809 then generation = 7
			elseif ndex_int <= 905 then generation = 8
			elseif ndex_int <= 1025 then generation = 9
			else generation = 10
			end
		else generation = 10
		end
	end

	-- Calcul automatique du nombre de formes et changement optionnel automatique d'artworks
	local nombre_formes = 1
	local couleur_principale
	local couleur_secondaire = nil
	while artwork[nombre_formes + 1] do
		nombre_formes = nombre_formes + 1
	end

	if nombre_formes > 1 and categories_wiki and categorisation_plusieurs_formes then table.insert(resultat, '[[Catégorie:Pokémon à plusieurs formes]]') end
	if tonumber(forme_principale) and nombre_formes >= tonumber(forme_principale)
	then forme_principale = tonumber(forme_principale)
	elseif nombre_formes > 1 and switch_artworks
		then forme_principale = (math.floor(os.time()) % nombre_formes) + 1
	else forme_principale = 1
	end
	if forme_principale > 1
	then if type1[forme_principale] then couleur_principale = type1[forme_principale] else couleur_principale = type1[1] end
		if type2 ~= {}
		then if type2[forme_principale] ~= nil and type2[forme_principale] ~= '' and type2[forme_principale] ~= '-'
				then couleur_secondaire = type2[forme_principale]
			elseif type2[forme_principale] == nil
				then if type2[1] == '' or type2[1] == '-'
					then couleur_secondaire = nil
					else couleur_secondaire = type2[1]
					end
			else couleur_secondaire = nil
			end
		end
		if forme_principale > 1
		then for i = forme_principale, 2, -1 do
			artwork[i], artwork[i-1] = artwork[i-1], artwork[i]
			end
		end
	else couleur_principale = type1[1]
		couleur_secondaire = type2[1]
	end
	if couleur_principale == "inconnu" then couleur_principale = "" end
	if couleur_secondaire == "inconnu" then couleur_secondaire = "" end

	-- Conditions de forme
	local conditions = frame.args['conditions']
	if conditions == nil then conditions = '' end
	conditions = mw.text.split(conditions, "/")
	local conditions_type = frame.args['conditions-type']
	if conditions_type == nil then conditions_type = '' end
	conditions_type = mw.text.split(conditions_type, "/")
	local conditions_categorie = frame.args['conditions-espèce'] -- deprecated
	local conditions_categorie = frame.args['conditions-catégorie']
	if conditions_categorie == nil then conditions_categorie = conditions_categorie end
	if conditions_categorie == nil then conditions_categorie = '' end
	conditions_categorie = mw.text.split(conditions_categorie, "/")
	local conditions_taille = frame.args['conditions-taille']
	if conditions_taille == nil then conditions_taille = '' end
	conditions_taille = mw.text.split(conditions_taille, "/")
	local conditions_poids = frame.args['conditions-poids']
	if conditions_poids == nil then conditions_poids = '' end
	conditions_poids = mw.text.split(conditions_poids, "/")
	local conditions_talents = frame.args['conditions-talents']
	if conditions_talents == nil then conditions_talents = '' end
	conditions_talents = mw.text.split(conditions_talents, "/")
	local conditions_oeufpas = frame.args['conditions-oeufpas']
	if conditions_oeufpas == nil then conditions_oeufpas = '' end
	conditions_oeufpas = mw.text.split(conditions_oeufpas, "/")
	local conditions_eclosion = frame.args['conditions-éclosion']
	if conditions_eclosion == nil then conditions_eclosion = '' end
	conditions_eclosion = mw.text.split(conditions_eclosion, "/")
	local conditions_effortval = frame.args['conditions-effortval']
	if conditions_effortval == nil then conditions_effortval = '' end
	conditions_effortval = mw.text.split(conditions_effortval, "/")
	local conditions_fmratio = frame.args['conditions-fmratio']
	if conditions_fmratio == nil then conditions_fmratio = '' end
	conditions_fmratio = mw.text.split(conditions_fmratio, "/")
	local conditions_couleur = frame.args['conditions-couleur']
	if conditions_couleur == nil then conditions_couleur = '' end
	conditions_couleur = mw.text.split(conditions_couleur, "/")
	local conditions_captureval = frame.args['conditions-captureval']
	if conditions_captureval == nil then conditions_captureval = '' end
	conditions_captureval = mw.text.split(conditions_captureval, "/")
	local conditions_corps = frame.args['conditions-corps']
	if conditions_corps == nil then conditions_corps = '' end
	conditions_corps = mw.text.split(conditions_corps, "/")
	local conditions_empreinte = frame.args['conditions-empreinte']
	if conditions_empreinte == nil then conditions_empreinte = '' end
	conditions_empreinte = mw.text.split(conditions_empreinte, "/")
	local conditions_cri = frame.args['conditions-cri']
	if conditions_cri == nil then conditions_cri = '' end
	conditions_cri = mw.text.split(conditions_cri, "/")
	local i = 1
	while conditions[i] do
		if conditions_categorie[i] == nil or conditions_categorie[i] == '' then conditions_categorie[i] = conditions[i] end
		if conditions_taille[i] == nil or conditions_taille[i] == '' then conditions_taille[i] = conditions[i] end
		if conditions_poids[i] == nil or conditions_poids[i] == '' then conditions_poids[i] = conditions[i] end
		if conditions_talents[i] == nil or conditions_talents[i] == '' then conditions_talents[i] = conditions[i] end
		if conditions_oeufpas[i] == nil or conditions_oeufpas[i] == '' then conditions_oeufpas[i] = conditions[i] end
		if conditions_eclosion[i] == nil or conditions_eclosion[i] == '' then conditions_eclosion[i] = conditions_oeufpas[i] end
		if conditions_effortval[i] == nil or conditions_effortval[i] == '' then conditions_effortval[i] = conditions[i] end
		if conditions_fmratio[i] == nil or conditions_fmratio[i] == '' then conditions_fmratio[i] = conditions[i] end
		if conditions_couleur[i] == nil or conditions_couleur[i] == '' then conditions_couleur[i] = conditions[i] end
		if conditions_captureval[i] == nil or conditions_captureval[i] == '' then conditions_captureval[i] = conditions[i] end
		if conditions_corps[i] == nil or conditions_corps[i] == '' then conditions_corps[i] = conditions[i] end
		if conditions_corps[i] == nil or conditions_corps[i] == '' then conditions_corps[i] = conditions[i] end
		if conditions_empreinte[i] == nil or conditions_empreinte[i] == '' then conditions_empreinte[i] = conditions[i] end
		if conditions_cri[i] == nil or conditions_cri[i] == '' then conditions_cri[i] = conditions[i] end
		i = i + 1
	end

	local espece = frame.args['espèce']	-- deprecated
	local categorie = frame.args['catégorie']
	if categorie == nil then categorie = espece end
	categorie = get_wikibase_or_arg( entity, PROPRIETES.categorie, categorie, 'string' )
	local taille = frame.args['taille']
	taille = get_form_qualified_or_arg( entity, PROPRIETES.taille, taille, conditions_taille, 'quantity' )
	local poids = frame.args['poids']
	poids = get_form_qualified_or_arg( entity, PROPRIETES.poids, poids, conditions_poids, 'quantity' )

	local talents = frame.args['talents']
	talents = get_talents_or_arg( entity, talents, conditions_talents )
	local groupeoeuf1 = frame.args['groupeoeuf1']
	local groupeoeuf1diff = frame.args['groupeoeuf1diff']
	local groupeoeuf2 = frame.args['groupeoeuf2']
	local groupeoeuf2diff = frame.args['groupeoeuf2diff']
	groupeoeuf1, groupeoeuf1diff, groupeoeuf2, groupeoeuf2diff = get_egg_groups_or_args( entity, groupeoeuf1, groupeoeuf2, groupeoeuf1diff, groupeoeuf2diff )
	local eclosion = frame.args['éclosion']
	eclosion = get_wikibase_or_arg( entity, PROPRIETES.eclosion, eclosion, 'quantity' )
	local oeufpas = frame.args['oeufpas']
	local effortval = frame.args['effortval']
	effortval = get_form_qualified_or_arg( entity, PROPRIETES.points_effort, effortval, conditions_effortval, 'string' )
	local expval = frame.args['expval']
	expval = get_generation_qualified_quantity_or_arg( entity, PROPRIETES.points_exp, expval )
	local expvaldiff = frame.args['expvaldiff']
	local expmax = frame.args['expmax']
	expmax = get_wikibase_or_arg( entity, PROPRIETES.exp_niveau_100, expmax, 'quantity' )
	local fmratio = frame.args['fmratio']
	fmratio = get_fmratio_or_arg( entity, fmratio, conditions_fmratio )
	local couleur = frame.args['couleur']
	couleur = get_wikibase_or_arg( entity, PROPRIETES.couleur, couleur, 'string' )
	local captureval = frame.args['captureval']
	captureval = get_wikibase_or_arg( entity, PROPRIETES.taux_capture, captureval, 'quantity' )
	local empreinte = frame.args['empreinte']
	local forme = frame.args['forme'] -- deprecated
	local corps = frame.args['corps']
	corps = get_body_shapes_or_args( entity, corps, forme )
	local cri = frame.args['cri']

	-- EN-TÊTE
	table.insert(resultat, '<table class="tableaustandard ficheinfo ' .. mw.ustring.lower(couleur_principale) .. '"><tbody><tr><th class="entêtesection')
	if couleur_secondaire ~= nil and couleur_secondaire ~= "" then table.insert(resultat, ' ' .. mw.ustring.lower(couleur_secondaire)) end
	table.insert(resultat, '" width="30%"><big><span class="explain" title="Numérotation nationale">№ ')
	if tonumber(ndex) and tonumber(ndex) > 905 and not force_ndex
	then table.insert(resultat, "—")
	else
		if ndex ~= "—" and donnee_semantique_ndex and donnees
		then table.insert(resultat, '[[Numéro National::' .. ndex .. ']]')
		else table.insert(resultat, ndex)
		end
	end
	table.insert(resultat, '</span></big></th><th class="entêtesection" colspan="3">' .. nom .. '</th>')

	-- ARTWORK
	table.insert(resultat, '<tr><td class="illustration" colspan="4">[[Fichier:' .. artwork[1] .. '.png|250px|class=pageimage]]')
	local i = 2
	while artwork[i] and artwork[i+1] and artwork[i+2] and artwork[i+3] and artwork[i+4] do
		table.insert(resultat, '<br/><br/>[[Fichier:' .. artwork[i] .. '.png|80px]] [[Fichier:' .. artwork[i+1] .. '.png|80px]] [[Fichier:' .. artwork[i+2] .. '.png|80px]]')
		i = i + 3
	end
	if artwork[i] and artwork[i+1] and artwork[i+2] and artwork[i+3]
		then table.insert(resultat, '<br/><br/>[[Fichier:' .. artwork[i] .. '.png|120px]] [[Fichier:' .. artwork[i+1] .. '.png|120px]]<br/><br/>[[Fichier:' .. artwork[i+2] .. '.png|120px]] [[Fichier:' .. artwork[i+3] .. '.png|120px]]')
	elseif artwork[i] and artwork[i+1] and artwork[i+2]
		then table.insert(resultat, '<br/><br/>[[Fichier:' .. artwork[i] .. '.png|80px]] [[Fichier:' .. artwork[i+1] .. '.png|80px]] [[Fichier:' .. artwork[i+2] .. '.png|80px]]')
	elseif artwork[i] and artwork[i+1]
		then table.insert(resultat, '<br/><br/>[[Fichier:' .. artwork[i] .. '.png|120px]] [[Fichier:' .. artwork[i+1] .. '.png|120px]]')
	elseif artwork[i]
		then table.insert(resultat, '<br/><br/>[[Fichier:' .. artwork[i] .. '.png|150px]]')
	end
	if legende ~= nil then table.insert(resultat, '<br/><small>' .. legende .. '</small>') end
	table.insert(resultat, '</td></tr>')

	-- NOM JAPONAIS
	table.insert(resultat, '<tr><th>Nom japonais</th><td colspan="3">')
	if nom_japonais ~= nil
	then if nom_romaji ~= nil and nom_romaji ~= '' and nom_romaji ~= nom_depose
		then table.insert(resultat, frame:expandTemplate{title='Furigana', args={nom_japonais, nom_romaji}})
		else table.insert(resultat, '<span lang="ja">' .. nom_japonais ..'</span>')
		end
	end
	if nom_depose ~= nil and nom_depose ~= ''
	then table.insert(resultat, ' <br/><span title="Nom déposé officiel"><i>' .. nom_depose .. '</i></span>')
	end
	table.insert(resultat, '</td></tr>')

	-- NOM ANGLAIS
	table.insert(resultat, '<tr><th>Nom anglais</th><td colspan="3">' .. nom_anglais .. '</td></tr>')

	-- NUMÉROS DE POKÉDEX
	table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Liste des Pokémon dans l\'ordre du Pokédex National|Numéros de Pokédex]] régionaux</th></tr>')
	if dex == nil or dex == ''
	then table.insert(resultat, '<tr><td colspan="4" style="text-align:center"><i>Ce Pokémon n\'apparaît dans aucun Pokédex régional.</i></td></tr>')
	else if dex ~= nil and dex ~= ''
		then table.insert(resultat, '<tr><td colspan="4" style="padding:0px;"><table style="width:100%;text-align:center;background-color:white;border-radius:3px;">') -- on fait une sous-table pour les dex
			dex = mw.text.split(dex, "//")
			local i = 1
			local infos_region1 = {}
			local infos_region2 = {}
			local infos_region3 = {}
			local infos_region4 = {}
			while dex[i] and dex[i+1] and dex[i+2] and dex[i+3] do -- on regroupe les régions par 4 jusqu'à ce qu'il en reste moins que 4
				infos_region1 = mw.text.split(dex[i], "/")
				infos_region2 = mw.text.split(dex[i+1], "/")
				infos_region3 = mw.text.split(dex[i+2], "/")
				infos_region4 = mw.text.split(dex[i+3], "/")
				table.insert(resultat, '<tr>')
				table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region1[1]) .. '</strong></small></em></td>')
				table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region2[1]) .. '</strong></small></em></td>')
				table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region3[1]) .. '</strong></small></em></td>')
				table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region4[1]) .. '</strong></small></em></td>')
				table.insert(resultat, '</tr><tr>')
				if infos_region1[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region1[2]) if infos_region1[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region1[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
				if infos_region2[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region2[2]) if infos_region2[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region2[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
				if infos_region3[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region3[2]) if infos_region3[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region3[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
				if infos_region4[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region4[2]) if infos_region4[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region4[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
				table.insert(resultat, '</tr>')
				i = i + 4
			end
			if dex[i] and dex[i+1] and dex[i+2] -- il ne reste plus que 3 régions
			then local infos_region1 = mw.text.split(dex[i], "/")
				local infos_region2 = mw.text.split(dex[i+1], "/")
				local infos_region3 = mw.text.split(dex[i+2], "/")
				table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region1[1]) .. '</strong></small></em></td>')
				table.insert(resultat, '<td colspan="2" style="line-height:8pt;width:50%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region2[1]) .. '</strong></small></em></td>')
				table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region3[1]) .. '</strong></small></em></td>')
				table.insert(resultat, '</tr><tr>')
				if infos_region1[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region1[2]) if infos_region1[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region1[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
				if infos_region2[2] ~= nil then table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">' .. infos_region2[2]) if infos_region2[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region2[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">—</td>') end
				if infos_region3[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region3[2]) if infos_region3[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region3[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
				table.insert(resultat, '</tr>')
			elseif dex[i] and dex[i+1] -- il ne reste plus que 2 régions
			then local infos_region1 = mw.text.split(dex[i], "/")
				local infos_region2 = mw.text.split(dex[i+1], "/")
				table.insert(resultat, '<td colspan="2" style="line-height:8pt;width:50%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region1[1]) .. '</strong></small></em></td>')
				table.insert(resultat, '<td colspan="2" style="line-height:8pt;width:50%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region2[1]) .. '</strong></small></em></td>')
				table.insert(resultat, '</tr><tr>')
				if infos_region1[2] ~= nil then table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">' .. infos_region1[2]) if infos_region1[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region1[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">—</td>') end
				if infos_region2[2] ~= nil then table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">' .. infos_region2[2]) if infos_region2[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region2[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">—</td>') end
				table.insert(resultat, '</tr>')
			elseif dex[i] -- il ne reste plus qu'1 région
			then local infos_region1 = mw.text.split(dex[i], "/")
				table.insert(resultat, '<tr><td colspan="4" style="line-height:8pt;width:100%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region1[1]) .. '</strong></small></em></td></tr><tr><td colspan="4" style="line-height:10pt;padding: 2px;">')
				if infos_region1[2] ~= nil then table.insert(resultat, infos_region1[2]) if infos_region1[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region1[3] .. '">*</span>') end table.insert(resultat, '</td></tr>') else table.insert(resultat, '—</td></tr>') end
			end
			table.insert(resultat, '</table></td></tr>')
		end
		dex = nil
	end
	-- meme chose pour les dex_secondaires : copier/coller en remplacant dex par dex_secondaires
	if dex_secondaires ~= nil and dex_secondaires ~= ''
	then dex_secondaires = mw.text.split(dex_secondaires, "//")
		table.insert(resultat, '<tr><th colspan="4" style="text-align:center">')
		local i = 1
		local region_avec_navigateur = false
		local region_sans_navigateur = false
		while dex_secondaires[i] do
			local b = false
			infos_region = mw.text.split(dex_secondaires[i], "/")
			if regions_navigateur[infos_region[1]]
			then region_avec_navigateur = true
			else region_sans_navigateur = true
			end
			i = i + 1
		end
		if region_avec_navigateur
		then if region_sans_navigateur
			then table.insert(resultat, '[[Capstick#Autres fonctions|Navigateurs]] et autres numérotations')
			else table.insert(resultat, '[[Capstick#Autres fonctions|Navigateurs]]')
			end
		else table.insert(resultat, 'Autres numérotations')
		end
		table.insert(resultat, '</th></tr><tr><td colspan="4" style="padding:0px;"><table style="width:100%;text-align:center;background-color:white;border-radius:3px;">') -- on fait une sous-table pour les dex_secondaires
		local i = 1
		local infos_region1 = {}
		local infos_region2 = {}
		local infos_region3 = {}
		local infos_region4 = {}
		while dex_secondaires[i] and dex_secondaires[i+1] and dex_secondaires[i+2] and dex_secondaires[i+3] do
			infos_region1 = mw.text.split(dex_secondaires[i], "/")
			infos_region2 = mw.text.split(dex_secondaires[i+1], "/")
			infos_region3 = mw.text.split(dex_secondaires[i+2], "/")
			infos_region4 = mw.text.split(dex_secondaires[i+3], "/")
			table.insert(resultat, '<tr>')
			table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region1[1]) .. '</strong></small></em></td>')
			table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region2[1]) .. '</strong></small></em></td>')
			table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region3[1]) .. '</strong></small></em></td>')
			table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region4[1]) .. '</strong></small></em></td>')
			table.insert(resultat, '</tr><tr>')
			if infos_region1[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region1[2]) if infos_region1[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region1[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
			if infos_region2[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region2[2]) if infos_region2[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region2[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
			if infos_region3[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region3[2]) if infos_region3[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region3[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
			if infos_region4[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region4[2]) if infos_region4[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region4[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
			table.insert(resultat, '</tr>')
			i = i + 4
		end
		if dex_secondaires[i] and dex_secondaires[i+1] and dex_secondaires[i+2] -- il ne reste plus que 3 régions
		then local infos_region1 = mw.text.split(dex_secondaires[i], "/")
			local infos_region2 = mw.text.split(dex_secondaires[i+1], "/")
			local infos_region3 = mw.text.split(dex_secondaires[i+2], "/")
			table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region1[1]) .. '</strong></small></em></td>')
			table.insert(resultat, '<td colspan="2" style="line-height:8pt;width:50%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region2[1]) .. '</strong></small></em></td>')
			table.insert(resultat, '<td style="line-height:8pt;width:25%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region3[1]) .. '</strong></small></em></td>')
			table.insert(resultat, '</tr><tr>')
			if infos_region1[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region1[2]) if infos_region1[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region1[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
			if infos_region2[2] ~= nil then table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">' .. infos_region2[2]) if infos_region2[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region2[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">—</td>') end
			if infos_region3[2] ~= nil then table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">' .. infos_region3[2]) if infos_region3[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region3[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td style="line-height:10pt;padding: 2px;">—</td>') end
			table.insert(resultat, '</tr>')
		elseif dex_secondaires[i] and dex_secondaires[i+1] -- il ne reste plus que 2 régions
		then local infos_region1 = mw.text.split(dex_secondaires[i], "/")
			local infos_region2 = mw.text.split(dex_secondaires[i+1], "/")
			table.insert(resultat, '<td colspan="2" style="line-height:8pt;width:50%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region1[1]) .. '</strong></small></em></td>')
			table.insert(resultat, '<td colspan="2" style="line-height:8pt;width:50%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region2[1]) .. '</strong></small></em></td>')
			table.insert(resultat, '</tr><tr>')
			if infos_region1[2] ~= nil then table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">' .. infos_region1[2]) if infos_region1[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region1[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">—</td>') end
			if infos_region2[2] ~= nil then table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">' .. infos_region2[2]) if infos_region2[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region2[3] .. '">*</span>') end table.insert(resultat, '</td>') else table.insert(resultat, '<td colspan="2" style="line-height:10pt;padding: 2px;">—</td>') end
			table.insert(resultat, '</tr>')
		elseif dex_secondaires[i] -- il ne reste plus qu'1 région
		then local infos_region1 = mw.text.split(dex_secondaires[i], "/")
			table.insert(resultat, '<tr><td colspan="4" style="line-height:8pt;width:100%;padding: 2px;"><em><small><strong>' .. association_region(frame, infos_region1[1]) .. '</strong></small></em></td></tr><tr><td colspan="4" style="line-height:10pt;padding: 2px;">')
			if infos_region1[2] ~= nil then table.insert(resultat, infos_region1[2]) if infos_region1[3] ~= nil then table.insert(resultat, '<span class="explain" title="' .. infos_region1[3] .. '">*</span>') end table.insert(resultat, '</td></tr>') else table.insert(resultat, '—</td></tr>') end
		end
		table.insert(resultat, '</table></td></tr>')
	end
	dex_secondaires = nil

	-- TYPES
	if not type1[2]
	-- Une seule forme
	then if type2[1] == nil
		then table.insert(resultat, '<tr><th>[[Type]]</th><td colspan="3">[[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type1[1]) .. '.png|80px|link=' .. type1[1] .. ' (type)]]')
			if donnees then table.insert(resultat, '[[Premier type::' .. type1[1] .. '|]]') end
			if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon de type ' .. type1[1] .. ']]') end
		else table.insert(resultat, '<tr><th>[[Type]]s</th><td colspan="3">[[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type1[1]) .. '.png|80px|link=' .. type1[1] .. ' (type)]] - [[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type2[1]) .. '.png|80px|link=' .. type2[1] .. ' (type)]]')
			if donnees then table.insert(resultat, '[[Premier type::' .. type1[1] .. '|]][[Second type::' .. type2[1] ..'|]]') end
			if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon de type ' .. type1[1] .. ']][[Catégorie:Pokémon de type ' .. type2[1] .. ']]') end
		end
		if conditions_type[1] ~= '' then table.insert(resultat, '<small> <i>(' .. nil_to_string(conditions_type[1]) .. ')</i></small></td>') end
		table.insert(resultat, '</td></tr>')
	-- Plusieurs formes
	else
		local i = 1
		-- initialisation ici pour pouvoir avoir une possibilité de précision même avec un seul set de types
		while conditions[i] do
			if conditions_type[i] == nil or conditions_type[i] == '' then conditions_type[i] = conditions[i] end
			i = i + 1
		end
		table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Type]]s</th></tr>')
		local i = 1
		while type1[i] and type1[i+1] do
			if type2 ~= {} then if type2[i] == nil then type2[i] = type2[1] end end
			if type2[i] == nil or type2[i] == '' or type2[i] == '-'
			then table.insert(resultat, '<tr><td colspan="2" style="text-align:center;">[[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type1[i]) .. '.png|80px|link=' .. type1[i] .. ' (type)]]')
				if donnees then table.insert(resultat, '[[Premier type::' .. type1[i] .. '|]]') end
				if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon de type ' .. type1[i] .. ']]') end
			else table.insert(resultat, '<tr><td colspan="2" style="text-align:center;">[[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type1[i]) .. '.png|80px|link=' .. type1[i] .. ' (type)]] - [[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type2[i]) .. '.png|80px|link=' .. type2[i] .. ' (type)]]')
				if donnees then table.insert(resultat, '[[Premier type::' .. type1[i] .. '|]][[Second type::' .. type2[i] ..'|]]') end
				if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon de type ' .. type1[i] .. ']][[Catégorie:Pokémon de type ' .. type2[i] .. ']]') end
			end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_type[i]) .. ')</i></small></td>')
			if type2 ~= {} then if type2[i+1] == nil then type2[i+1] = type2[1] end end
			if type2[i+1] == nil or type2[i+1] == '' or type2[i+1] == '-'
			then table.insert(resultat, '<td colspan="2" style="text-align:center;">[[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type1[i+1]) .. '.png|80px|link=' .. type1[i+1] .. ' (type)]]')
				if donnees then table.insert(resultat, '[[Premier type::' .. type1[i+1] .. '|]]') end
				if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon de type ' .. type1[i+1] .. ']]') end
			else table.insert(resultat, '<td colspan="2" style="text-align:center;">[[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type1[i+1]) .. '.png|80px|link=' .. type1[i+1] .. ' (type)]] - [[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type2[i+1]) .. '.png|80px|link=' .. type2[i+1] .. ' (type)]]')
				if donnees then table.insert(resultat, '[[Premier type::' .. type1[i+1] .. '|]][[Second type::' .. type2[i+1] ..'|]]') end
				if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon de type ' .. type1[i+1] .. ']][[Catégorie:Pokémon de type ' .. type2[i+1] .. ']]') end
			end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_type[i+1]) .. ')</i></small></td></tr>')
			i = i + 2
		end
		if type1[i]
		then if type2[i] == nil or type2[i] == '' or type2[i] == '-'
			then table.insert(resultat, '<tr><td colspan="4" style="text-align:center">[[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type1[i]) .. '.png|80px|link=' .. type1[i] .. ' (type)]]')
				if donnees then table.insert(resultat, '[[Premier type::' .. type1[i] .. '|]]') end
				if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon de type ' .. type1[i] .. ']]') end
			else table.insert(resultat, '<tr><td colspan="4" style="text-align:center">[[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type1[i]) .. '.png|80px|link=' .. type1[i] .. ' (type)]] - [[Fichier:Miniature Type ' .. mw.getContentLanguage():ucfirst(type2[i]) .. '.png|80px|link=' .. type2[i] .. ' (type)]]')
				if donnees then table.insert(resultat, '[[Premier type::' .. type1[i] .. '|]][[Second type::' .. type2[i] ..'|]]') end
				if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon de type ' .. type1[i] .. ']][[Catégorie:Pokémon de type ' .. type2[i] .. ']]') end
			end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_type[i]) .. ')</i></small></td></tr>')
		end
	end

	-- CATÉGORIE
	if categorie == nil then categorie = {} else categorie = mw.text.split(categorie, "/") end
	if categorie[2] == nil
	then table.insert(resultat, '<tr><th>[[Catégorie]]</th><td colspan="3">')
		if categorie[1] == nil or categorie[1] == ''
		then table.insert(resultat, '—')
			if categories_wiki
			then table.insert(resultat, "[[Catégorie:Pokémon dont la catégorie est inconnue]]")
			end
		else table.insert(resultat, '[[Pokémon (créature)|Pokémon]] ')
			if donnees then table.insert(resultat, '[[Catégorie du Pokémon::' .. categorie[1] .. ']]') else table.insert(resultat, categorie[1]) end
		end
		table.insert(resultat, '</td></tr>')
	else table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Catégorie]]s</th></tr>')
		local i = 1
		while categorie[i] and categorie[i+1] do
			table.insert(resultat, '<tr><td colspan="2" style="text-align:center">[[Pokémon (créature)|Pokémon]] ')
			if donnees then table.insert(resultat, '[[Catégorie du Pokémon::' .. categorie[i] .. ']]') else table.insert(resultat, categorie[i]) end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_categorie[i]) .. ')</i></small></td>')

			table.insert(resultat, '<td colspan="2" style="text-align:center">[[Pokémon (créature)|Pokémon]] ')
			if donnees then table.insert(resultat, '[[Catégorie du Pokémon::' .. categorie[i+1] .. ']]') else table.insert(resultat, categorie[i+1]) end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_categorie[i+1]) .. ')</i></small></td></tr>')
			i = i + 2
		end
		if categorie[i]
		then table.insert(resultat, '<tr><td colspan="4" style="text-align:center">[[Pokémon (créature)|Pokémon]] ')
			if donnees then table.insert(resultat, '[[Catégorie du Pokémon::' .. categorie[i] .. ']]') else table.insert(resultat, categorie[i]) end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_categorie[i]) .. ')</i></small></td></tr>')
		end
	end
	categorie = nil

	-- TAILLE
	if taille == nil then taille = {} else taille = mw.text.split(taille, "/") end
	if taille[2] == nil
	-- Une seule forme
	then table.insert(resultat, '<tr><th>[[Taille]]</th><td colspan="3">')
		if taille[1] == nil or taille[1] == '' or taille[1] == '-'
		then table.insert(resultat, '???,? m')
			if categories_wiki and taille[1] ~= '-'
			then table.insert(resultat, "[[Catégorie:Pokémon dont la taille est inconnue]]")
			end
		else local taille_plus = false
			if string.sub(taille[1], -1, -1) == '+'
			then taille[1] = string.sub(taille[1], 1, -2)
				taille_plus = true
			end
			if tonumber(taille[1])
			then if taille_plus then table.insert(resultat, 'Plus de ') end
				if donnees
				then table.insert(resultat, '[[Taille::' .. decimal_dot_to_comma(taille[1]) .. ']] m, soit ') -- on change la notation de type '0.2' en '0,2'.
				else table.insert(resultat, decimal_dot_to_comma(taille[1]) .. ' m, soit ')
				end

				local taille_pieds_pouces = meters_to_feet_and_inches(taille[1])
				local taille_pieds = taille_pieds_pouces.feet
				local taille_pouces = taille_pieds_pouces.inches
				table.insert(resultat, taille_pieds .. ' pied')
				if taille_pieds > 1.0 then table.insert(resultat, 's') end
				table.insert(resultat, ' ' .. taille_pouces .. ' pouce')
				if taille_pouces > 1.0 then table.insert(resultat, 's') end

			else table.insert(resultat, '[[Fichier:Panneau Attention.png|x20px|Erreur dans la saisie de la taille : le format doit être de la forme « xxx.y », sans indiquer « m ».]] <i>' .. taille[1] .. '</i>[[Catégorie:Pokémon dont la taille est mal indiquée]]')
			end
			table.insert(resultat, '</td></tr>')
		end
	-- Plusieurs formes
	else table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Taille|Tailles]]</th></tr>')
		local i = 1
		local taille_pieds
		while taille[i] and taille[i+1] do
			table.insert(resultat, '<tr><td colspan="2" style="text-align:center;">')
			local taille_plus = false
			if string.sub(taille[i], -1, -1) == '+'
			then taille[i] = string.sub(taille[i], 1, -2)
				taille_plus = true
			end
			if tonumber(taille[i])
			then if taille_plus then table.insert(resultat, 'Plus de ') end
				if donnees
				then table.insert(resultat, '[[Taille::' .. decimal_dot_to_comma(taille[i]) .. ']] m, soit<br/>') -- on change la notation de type '0.2' en '0,2'.
				else table.insert(resultat, decimal_dot_to_comma(taille[i]) .. ' m, soit<br/>')
				end

				local taille_pieds_pouces = meters_to_feet_and_inches(taille[i])
				local taille_pieds = taille_pieds_pouces.feet
				local taille_pouces = taille_pieds_pouces.inches
				table.insert(resultat, taille_pieds .. ' pied')
				if taille_pieds > 1.0 then table.insert(resultat, 's') end
				table.insert(resultat, ' ' .. taille_pouces .. ' pouce')
				if taille_pouces > 1.0 then table.insert(resultat, 's') end
			elseif taille[i] == '' or taille[i] == '-'
				then table.insert(resultat, '???,? m')
			else table.insert(resultat, '[[Fichier:Panneau Attention.png|x20px|Erreur dans la saisie de la taille : le format doit être de la forme « xxx.y », sans indiquer « m ».]] <i>' .. taille[i] .. '</i>[[Catégorie:Pokémon dont la taille est mal indiquée]]')
			end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_taille[i]) .. ')</i></small></td><td colspan="2" style="text-align:center;">')
			local taille_plus = false
			if string.sub(taille[i+1], -1, -1) == '+'
			then taille[i+1] = string.sub(taille[i+1], 1, -2)
				taille_plus = true
			end
			if tonumber(taille[i+1])
			then if taille_plus then table.insert(resultat, 'Plus de ') end
				if donnees
				then table.insert(resultat, '[[Taille::' .. decimal_dot_to_comma(taille[i+1]) .. ']] m, soit<br/>') -- on change la notation de type '0.2' en '0,2'.
				else table.insert(resultat, decimal_dot_to_comma(taille[i+1]) .. ' m, soit<br/>')
				end

				local taille_pieds_pouces = meters_to_feet_and_inches(taille[i+1])
				local taille_pieds = taille_pieds_pouces.feet
				local taille_pouces = taille_pieds_pouces.inches
				table.insert(resultat, taille_pieds .. ' pied')
				if taille_pieds > 1.0 then table.insert(resultat, 's') end
				table.insert(resultat, ' ' .. taille_pouces .. ' pouce')
				if taille_pouces > 1.0 then table.insert(resultat, 's') end
			elseif taille[i+1] == '' or taille[i+1] == '-'
				then table.insert(resultat, '???,? m')
			else table.insert(resultat, '[[Fichier:Panneau Attention.png|x20px|Erreur dans la saisie de la taille : le format doit être de la forme « xxx.y », sans indiquer « m ».]] <i>' .. taille[i+1] .. '</i>[[Catégorie:Pokémon dont la taille est mal indiquée]]')
			end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_taille[i+1]) .. ')</i></small></td></tr>')
			i = i + 2
		end
		if taille[i]
		then local taille_plus = false
			if string.sub(taille[i], -1, -1) == '+'
			then taille[i] = string.sub(taille[i], 1, -2)
				taille_plus = true
			end
			table.insert(resultat, '<tr><td colspan="4" style="text-align:center">')
			if tonumber(taille[i])
			then if taille_plus then table.insert(resultat, 'Plus de ') end
				if donnees
				then table.insert(resultat, '[[Taille::' .. decimal_dot_to_comma(taille[i]) .. ']] m, soit ') -- on change la notation de type '0.2' en '0,2'.
				else table.insert(resultat, decimal_dot_to_comma(taille[i]) .. ' m, soit ')
				end

				local taille_pieds_pouces = meters_to_feet_and_inches(taille[i])
				local taille_pieds = taille_pieds_pouces.feet
				local taille_pouces = taille_pieds_pouces.inches
				table.insert(resultat, taille_pieds .. ' pied')
				if taille_pieds > 1.0 then table.insert(resultat, 's') end
				table.insert(resultat, ' ' .. taille_pouces .. ' pouce')
				if taille_pouces > 1.0 then table.insert(resultat, 's') end
			elseif taille[i] == '' or taille[i] == '-'
				then table.insert(resultat, '???,? m')
			else table.insert(resultat, '[[Fichier:Panneau Attention.png|x20px|Erreur dans la saisie de la taille : le format doit être de la forme « xxx.y », sans indiquer « m ».]] <i>' .. taille[i] .. '</i>[[Catégorie:Pokémon dont la taille est mal indiquée]]')
			end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_taille[i]) .. ')</i></small></td></tr>')
		end
	end
	taille = nil

	-- POIDS
	if poids == nil then poids = {} else poids = mw.text.split(poids, "/") end
	if poids[2] == nil
	-- Une seule forme
	then table.insert(resultat, '<tr><th>[[Poids]]</th><td colspan="3">')
		if poids[1] == nil or poids[1] == '' or poids[1] == '-'
		then table.insert(resultat, '???,? kg')
			if categories_wiki and poids[1] ~= '-'
			then table.insert(resultat, "[[Catégorie:Pokémon dont le poids est inconnu]]")
			end
		else if tonumber(poids[1])
			then if donnees
				then table.insert(resultat, '[[Poids::' .. decimal_dot_to_comma(poids[1]) .. ']] kg, soit ') -- on change la notation de type '0.2' en '0,2'.
				else table.insert(resultat, decimal_dot_to_comma(poids[1]) .. ' kg, soit ')
				end
				local poids_livres = kg_to_pounds(poids[1])
				if poids_livres <= 1.0
				then table.insert(resultat, decimal_dot_to_comma(tostring(poids_livres)) .. ' livre')
				else table.insert(resultat, decimal_dot_to_comma(tostring(poids_livres)) .. ' livres')
				end
			else table.insert(resultat, '[[Fichier:Panneau Attention.png|x20px|Erreur dans la saisie du poids : le format doit être de la forme « xxx.y », sans indiquer « kg ».]] <i>' .. poids[1] .. '</i>[[Catégorie:Pokémon dont le poids est mal indiqué]]')
			end
			table.insert(resultat, '</td></tr>')
		end
	-- Plusieurs formes
	else table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Poids]]</th></tr>')
		local i = 1
		local poids_livres
		while poids[i] and poids[i+1] do
			table.insert(resultat, '<tr><td colspan="2" style="text-align:center;">')
			if tonumber(poids[i])
			then if donnees
				then table.insert(resultat, '[[Poids::' .. decimal_dot_to_comma(poids[i]) .. ']] kg, soit<br/>') -- on change la notation de type '0.2' en '0,2'.
				else table.insert(resultat, decimal_dot_to_comma(poids[i]) .. ' kg, soit<br/>')
				end
				local poids_livres = kg_to_pounds(poids[i])
				if poids_livres <= 1.0
				then table.insert(resultat, decimal_dot_to_comma(tostring(poids_livres)) .. ' livre')
				else table.insert(resultat, decimal_dot_to_comma(tostring(poids_livres)) .. ' livres')
				end
			elseif poids[i] == '' or poids[i] == '-'
				then table.insert(resultat, '???,? kg')
			else table.insert(resultat, '[[Fichier:Panneau Attention.png|x20px|Erreur dans la saisie du poids : le format doit être de la forme « xxx.y », sans indiquer « kg ».]] <i>' .. poids[1] .. '</i>[[Catégorie:Pokémon dont le poids est mal indiqué]]')
			end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_poids[i]) .. ')</i></small></td><td colspan="2" style="text-align:center;">')
			if tonumber(poids[i+1])
			then if donnees
				then table.insert(resultat, '[[Poids::' .. decimal_dot_to_comma(poids[i+1]) .. ']] kg, soit<br/>') -- on change la notation de type '0.2' en '0,2'.
				else table.insert(resultat, decimal_dot_to_comma(poids[i+1]) .. ' kg, soit<br/>')
				end
				local poids_livres = kg_to_pounds(poids[i+1])
				if poids_livres <= 1.0
				then table.insert(resultat, decimal_dot_to_comma(tostring(poids_livres)) .. ' livre')
				else table.insert(resultat, decimal_dot_to_comma(tostring(poids_livres)) .. ' livres')
				end
			elseif poids[i+1] == '' or poids[i+1] == '-'
				then table.insert(resultat, '???,? kg')
			else table.insert(resultat, '[[Fichier:Panneau Attention.png|x20px|Erreur dans la saisie du poids : le format doit être de la forme « xxx.y », sans indiquer « kg ».]] <i>' .. poids[i+1] .. '</i>[[Catégorie:Pokémon dont le poids est mal indiqué]]')
			end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_poids[i+1]) .. ')</i></small></td></tr>')
			i = i + 2
		end
		if poids[i]
		then table.insert(resultat, '<tr><td colspan="4" style="text-align:center">')
			if tonumber(poids[i])
			then if donnees
				then table.insert(resultat, '[[Poids::' .. decimal_dot_to_comma(poids[i]) .. ']] kg, soit ') -- on change la notation de type '0.2' en '0,2'.
				else table.insert(resultat, decimal_dot_to_comma(poids[i]) .. ' kg, soit ')
				end
				local poids_livres = kg_to_pounds(poids[i])
				if poids_livres <= 1.0
				then table.insert(resultat, decimal_dot_to_comma(tostring(poids_livres)) .. ' livre')
				else table.insert(resultat, decimal_dot_to_comma(tostring(poids_livres)) .. ' livres')
				end
			elseif poids[i] == '' or poids[i] == '-'
				then table.insert(resultat, '???,? kg')
			else table.insert(resultat, '[[Fichier:Panneau Attention.png|x20px|Erreur dans la saisie du poids : le format doit être de la forme « xxx.y », sans indiquer « kg ».]] <i>' .. poids[i] .. '</i>[[Catégorie:Pokémon dont le poids est mal indiqué]]')
			end
			table.insert(resultat, '<br/><small><i>(' .. nil_to_string(conditions_poids[i]) .. ')</i></small></td></tr>')
		end
	end
	poids = nil

	-- TALENTS
	if talents == nil or talents == ''
	then table.insert(resultat, '<tr><th>[[Talent]]s</th><td colspan="3">—</td></tr>')
		if categories_wiki
		then table.insert(resultat, "[[Catégorie:Pokémon dont le talent est inconnu]]")
		end
	else
		function talents_to_list(talents)
			talents = mw.text.split(talents, "//")
			local j = 1
			local infos_talent = {}
			local init = true
			local function_ans = {}
			while talents[j] do
				infos_talent_j = mw.text.split(talents[j], "/")

				if infos_talent_j[1] ~= nil then
					if init	then init = false else table.insert(function_ans, '<br>') end
					if talents[2] then table.insert(function_ans, j .. '. ') end

					if infos_talent_j[1] == "" or infos_talent_j[1] == '-' or infos_talent_j[1] == '—'
					then table.insert(function_ans, '—')
					else table.insert(function_ans, '[[' .. infos_talent_j[1] .. ']]')
					end

					if infos_talent_j[2] ~= nil and infos_talent_j[2] ~= "" then
						table.insert(function_ans, '<small> <i>(' .. infos_talent_j[2] .. ')</i></small>')
					end
				end
				j = j + 1
			end
			return {["how_many"] = j - 1, ["ans"] = table.concat(function_ans, "")}
		end
		talents = mw.text.split(talents, "///")
		if not talents[2]
		then local ttl = talents_to_list(talents[1])
			local plural = ""
			if ttl.how_many >= 2 then plural = "s" end
			table.insert(resultat, '<tr><th>[[Talent]]' .. plural .. '</th><td colspan="3">' .. ttl.ans .. '</td></tr>')
		else
			table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Talent]]s</th></tr>')
			local i = 1
			while talents[i] and talents[i+1] do
				local ttl_i = talents_to_list(talents[i])
				local ttl_ip1 = talents_to_list(talents[i+1])

				if ttl_i.how_many >= 2
				then table.insert(resultat, '<tr><td colspan="2">' .. ttl_i.ans .. '<div style="text-align:center"><small><i>(' .. nil_to_string(conditions_talents[i]) .. ')</i></small></div></td>')
				else table.insert(resultat, '<tr><td colspan="2" style="text-align:center">' .. ttl_i.ans .. '<div style="text-align:center"><small><i>(' .. nil_to_string(conditions_talents[i]) .. ')</i></small></div></td>')
				end

				if ttl_ip1.how_many >= 2
				then table.insert(resultat, '<td colspan="2">' .. ttl_ip1.ans .. '<div style="text-align:center"><small><i>(' .. nil_to_string(conditions_talents[i+1]) .. ')</i></small></div></td></tr>')
				else table.insert(resultat, '<td colspan="2" style="text-align:center">' .. ttl_ip1.ans .. '<div style="text-align:center"><small><i>(' .. nil_to_string(conditions_talents[i+1]) .. ')</i></small></div></td></tr>')
				end

				i = i + 2
			end
			if talents[i]
			then
				local ttl_i = talents_to_list(talents[i])

				if ttl_i.how_many >= 2
				then table.insert(resultat, '<tr><td colspan="4">' .. ttl_i.ans .. '<div style="text-align:center"><small><i>(' .. nil_to_string(conditions_talents[i]) .. ')</i></small></div></td></tr>')
				else table.insert(resultat, '<tr><td colspan="4" style="text-align:center">' .. ttl_i.ans .. '<small><br><i>(' .. nil_to_string(conditions_talents[i]) .. ')</i></small></td></tr>')
				end
			end
		end
	end
	talents = nil

	-- GROUPES ŒUF
	if groupeoeuf2 ~= nil and groupeoeuf2 ~= '' and groupeoeuf2 ~= '-'
	then table.insert(resultat, '<tr><th>[[Liste des Pokémon par groupe d\'Œuf|Groupes d\'Œuf]]</th><td colspan="3">')
	else table.insert(resultat, '<tr><th>[[Liste des Pokémon par groupe d\'Œuf|Groupe d\'Œuf]]</th><td colspan="3">')
	end
	if groupeoeuf1 == nil or groupeoeuf1 == '' or groupeoeuf1 == '-'
	then table.insert(resultat, '—')
		if categories_wiki
		then table.insert(resultat, "[[Catégorie:Pokémon dont le groupe d'Œuf est inconnu]]")
		end
	else table.insert(resultat, '[[:Catégorie:Pokémon du groupe ' .. groupeoeuf1 .. '|' .. groupeoeuf1 .. ']]')
		if groupeoeuf1diff ~= nil
		then table.insert(resultat, '<small> <i>(' .. groupeoeuf1diff .. ')</i></small>')
		end
		if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon du groupe ' .. groupeoeuf1 .. ']]') end
		if groupeoeuf2 ~= nil and groupeoeuf2 ~= '' and groupeoeuf2 ~= '-'
		then table.insert(resultat, '<br>[[:Catégorie:Pokémon du groupe ' .. groupeoeuf2 .. '|' .. groupeoeuf2 .. ']]')
			if groupeoeuf2diff ~= nil
			then table.insert(resultat, '<small> <i>(' .. groupeoeuf2diff .. ')</i></small>')
			end
			if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon du groupe ' .. groupeoeuf2 .. ']]') end
		end
	end
	table.insert(resultat, '</td></tr>')

	-- ÉCLOSION
	if oeufpas == nil
	then oeufpas = {}
		if eclosion == nil then eclosion = {} else eclosion = mw.text.split(eclosion, "/") end
	else oeufpas = mw.text.split(oeufpas, "/")
		if eclosion == nil
		then eclosion = {}
			local oeufpas_i = 1
			while oeufpas[oeufpas_i] and tonumber(oeufpas[oeufpas_i]) do
				eclosion[oeufpas_i] = math.floor(oeufpas[oeufpas_i]/255) - 1
				oeufpas_i = oeufpas_i + 1
			end
		else eclosion = mw.text.split(eclosion, "/")
		end
	end
	if eclosion[2] == nil
	then if tonumber(eclosion[1])
		then table.insert(resultat, '<tr><th>Éclosion</th><td colspan="3">')

			local s = ''
			if tonumber(eclosion[1]) > 1
			then s = 's'
			end

			if donnees
			then table.insert(resultat, '[[Éclosion::' .. eclosion[1] .. "]] [[Cycle d'éclosion|cycle]]" .. s)
			else table.insert(resultat, eclosion[1] .. " [[Cycle d'éclosion|cycle]]" .. s)
			end

			table.insert(resultat, '</td></tr>')
		else if categories_wiki and oeufpas[1] ~= '-'
			then table.insert(resultat, "[[Catégorie:Pokémon dont le temps d'éclosion est inconnu]]")
			end
		end
	else table.insert(resultat, '<tr><th colspan="4" style="text-align:center">Éclosion</th></tr>')
		local i = 1
		while eclosion[i] and tonumber(eclosion[i]) and eclosion[i+1] and tonumber(eclosion[i+1]) do

			local s = ''
			if tonumber(eclosion[i]) > 1 then s = 's' end
			table.insert(resultat, '<tr><td colspan="2" style="text-align:center">')
			if donnees
			then table.insert(resultat, '[[Éclosion::' .. eclosion[i] .. ']]')
			else table.insert(resultat, eclosion[i])
			end
			table.insert(resultat, " [[Cycle d'éclosion|cycle]]" .. s .. '<br><small><i>(' .. nil_to_string(conditions_eclosion[i]) .. ')</i></small></td>')

			if tonumber(eclosion[i+1]) > 1 then s = 's' else s = '' end
			table.insert(resultat, '<td colspan="2" style="text-align:center">')
			if donnees
			then table.insert(resultat, '[[Éclosion::' .. eclosion[i+1] .. ']]')
			else table.insert(resultat, eclosion[i+1])
			end
			table.insert(resultat, " [[Cycle d'éclosion|cycle]]" .. s .. '<br><small><i>(' .. nil_to_string(conditions_eclosion[i+1]) .. ')</i></small></td></tr>')
			i = i + 2
		end
		if eclosion[i]
		then
			local s = ''
			if tonumber(eclosion[i]) > 1 then s = 's' end
			table.insert(resultat, '<tr><td colspan="4" style="text-align:center">')
			if donnees
			then table.insert(resultat, '[[Éclosion::' .. eclosion[i] .. ']]')
			else table.insert(resultat, eclosion[i])
			end
			table.insert(resultat, " [[Cycle d'éclosion|cycle]]" .. s .. '<br><small><i>(' .. nil_to_string(conditions_eclosion[i]) .. ')</i></small></td></tr>')
		end
	end


	-- EV
	if effortval == nil then effortval = {} else effortval = mw.text.split(effortval, "/") end
	if effortval[2] == nil
	then table.insert(resultat, '<tr><th>[[EV|Points effort]]</th><td colspan="3">')
		if effortval[1] == nil or effortval[1] == ''
		then table.insert(resultat, '—')
			if categories_wiki
			then table.insert(resultat, "[[Catégorie:Pokémon dont les EV gagnés sont inconnus]]")
			end
		else if donnees
			then table.insert(resultat, '[[Points effort::' .. effortval[1] .. ']]')
			else table.insert(resultat, effortval[1])
			end
		end
		table.insert(resultat, '</td></tr>')
	else table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[EV|Points effort]]</th></tr>')
		local i = 1
		while effortval[i] and effortval[i+1] do
			if donnees then for z = i, i+1 do effortval[z] = '[[Points effort::' .. effortval[z] .. ']]' end end
			table.insert(resultat, '<tr><td colspan="2" style="text-align:center">' .. effortval[i] .. '<br/><small><i>(' .. nil_to_string(conditions_effortval[i]) .. ')</i></small></td>')
			table.insert(resultat, '<td colspan="2" style="text-align:center">' .. effortval[i+1] .. '<br/><small><i>(' .. nil_to_string(conditions_effortval[i+1]) .. ')</i></small></td></tr>')
			i = i + 2
		end
		if effortval[i]
		then if donnees then effortval[i] = '[[Points effort::' .. effortval[i] .. ']]' end
			table.insert(resultat, '<tr><td colspan="4" style="text-align:center">' .. effortval[i] .. '<br/><small><i>(' .. nil_to_string(conditions_effortval[i]) .. ')</i></small></td></tr>') end
	end
	effortval = nil

	-- POINTS EXP
	table.insert(resultat, '<tr><th>[[Expérience|Points exp.]]</th><td colspan="3">')
	if expval == nil or expval == ""
	then if categories_wiki
		then table.insert(resultat, "[[Catégorie:Pokémon dont le gain d'expérience est inconnu]]")
		end
		expval = {"—"}
	else expval = mw.text.split(expval, "//")
	end
	i = 1
	while expval[i] do
		expval_i = mw.text.split(expval[i], "/")
		if expval_i[1] == "—"
		then table.insert(resultat, '—')
		else if i ~= 1 then table.insert(resultat, "<br>") end
			if donnees and expval[i+1] == nil -- semantic data only for the latest instance
			then table.insert(resultat, '[[Points exp::' .. expval_i[1] .. ']] exp.')
			else table.insert(resultat, expval_i[1] .. ' exp.')
			end
			if expval_i[2]
			then table.insert(resultat, "<small> <i>(" .. expval_i[2] .. ")</i></small>")
			end

			if i == 1 and expvaldiff ~= nil
			then table.insert(resultat, ' (' .. expvaldiff .. ')')
			end
		end
		i = i + 1
	end
	table.insert(resultat, '</td></tr>')

	-- EXPÉRIENCE AU NIVEAU 100
	table.insert(resultat, '<tr><th>[[Expérience|Exp au niveau 100]]</th><td colspan="3">')
	if expmax then expmax = expmax:gsub(" ", "") end -- Pour permettre la saisie de données sous la forme "1 000 000"

	if not tonumber(expmax)
	then table.insert(resultat, '—')
		if categories_wiki
		then table.insert(resultat, "[[Catégorie:Pokémon dont l'expérience au niveau 100 est inconnue]]")
		end
	else expmax = separate_thousands(expmax)
		if donnees
		then table.insert(resultat, '[[Exp au niveau 100::' .. expmax .. ']] exp.')
		else table.insert(resultat, expmax .. ' exp.')
		end
	end
	table.insert(resultat, '</td></tr>')

	-- SEXE
	table.insert(resultat, '<tr><th>[[Liste des Pokémon par répartition des sexes|Sexe]]</th><td colspan="3">')
	if fmratio == nil or fmratio == '' or fmratio == '-'
	then table.insert(resultat, '<i>Répartition inconnue</i>')
		if categories_wiki
		then table.insert(resultat, "[[Catégorie:Pokémon dont la répartition des sexes est inconnue]]")
		end
	else fmratio = mw.text.split(fmratio, "/")
		local i = 1
		local init = true
		while fmratio[i] do
			if tonumber(fmratio[i])
			then fmratio[i] = tonumber(fmratio[i])
				if init then init = false else table.insert(resultat, '<br/>') end
				if fmratio[i] == -1
				then table.insert(resultat, 'Asexué')
					if fmratio[2] then table.insert(resultat, ' <i><small>(' .. nil_to_string(conditions_fmratio[i]) .. ')</small></i>') end
					if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon asexué]]') end
				else table.insert(resultat, fmratio[i]*100 .. ' % femelle ; ' .. 100-fmratio[i]*100 .. ' % mâle<br/><div style="border-radius: 10px;overflow: hidden;line-height: 15px;"><div style="background-color:pink;display:inline-block;width:' .. fmratio[i]*100 .. '%">&nbsp;</div><div style="background-color:lightblue;display:inline-block;width:' .. 100-fmratio[i]*100 .. '%">&nbsp;</div></div>')
					if fmratio[2] then table.insert(resultat, '<i><small>(' .. nil_to_string(conditions_fmratio[i]) .. ')</small></i>') end
					if categories_wiki and fmratio[i] == 1 then table.insert(resultat, '[[Catégorie:Pokémon uniquement femelle]]')
					elseif categories_wiki and fmratio[i] == 0 then table.insert(resultat, '[[Catégorie:Pokémon uniquement mâle]]') end
				end
			end
			i = i + 1
		end
	end
	table.insert(resultat, '</td></tr>')

	-- COULEUR
	if not debug_mode and (couleur == nil or couleur == '' or couleur == '-' or couleur == 'Inconnue')
	then if categories_wiki then table.insert(resultat, '[[Catégorie:Pokémon dont la couleur est inconnue]]') end
		-- En commentaire : un code pour mettre la couleur "Inconnu" par défaut. Actuellement, on retire complètement la section.
		-- table.insert(resultat, '<tr><th>[[Couleur]]</th><td colspan="3">—')
		-- table.insert(resultat, '</th></tr>')
	else if couleur == nil then couleur = '' end
		couleur = mw.text.split(couleur, "/")
		local i = 1
		local init = true
		if couleur[2]
		then table.insert(resultat, '<tr><th>[[Couleur|Couleurs]]</th><td colspan="3">')
		else table.insert(resultat, '<tr><th>[[Couleur]]</th><td colspan="3">')
		end
		while couleur[i] do
			if init then init = false else table.insert(resultat, '<br/>') end
			if donnees then table.insert(resultat, '[[Couleur::' .. couleur[i] .. '|]]') end
			table.insert(resultat, frame:expandTemplate{title='Image couleur', args={couleur[i]}})
			if categories_wiki
			then if couleur[i] ~= "Inconnue"
				then table.insert(resultat, '[[Catégorie:Pokémon listé comme ' .. couleur[i] .. ']]')
				else table.insert(resultat, '[[Catégorie:Pokémon dont la couleur est inconnue]]')
				end
			end
			if couleur[2] then table.insert(resultat, ' <i><small>(' .. nil_to_string(conditions_couleur[i]) .. ')</small></i>') end
			i = i + 1
		end
		table.insert(resultat, '</td></tr>')
	end
	couleur = nil

	-- TAUX DE CAPTURE
	if not debug_mode and not (captureval == nil or captureval == '' or captureval == '-')
	then
		if captureval == nil then captureval = '' end
		table.insert(resultat, '<tr><th>[[Capture de Pokémon|Taux de capture]]</th><td colspan="3">')
		captureval = mw.text.split(captureval, "/")
		local i = 1
		local init = true
		while captureval[i] do
			if init then init = false else table.insert(resultat, '<br/>') end
			if donnees then table.insert(resultat, '[[Taux de capture::' .. captureval[i] .. ']]') else table.insert(resultat, captureval[i]) end
			if captureval[2] then table.insert(resultat, ' <i><small>(' .. nil_to_string(conditions_captureval[i]) .. ')</small></i>') end
			i = i + 1
		end
		table.insert(resultat, '</td></tr>')
	else if categories_wiki
		then table.insert(resultat, "[[Catégorie:Pokémon dont le taux de capture est inconnu]]")
		end
	end

	-- EMPREINTE
	table.insert(resultat, '')
	if debug_mode or (empreinte ~= '-' and (empreinte == nil or empreinte == '')) and tonumber(ndex) and generation <= 5
	then table.insert(resultat, '<tr><th>Empreinte</th><td colspan="3">[[Fichier:Empreinte ' .. ndex .. '.png|x22px|class=imagenoire]]</td></tr>')
	elseif not(empreinte == nil or empreinte == '' or empreinte == '-')
	then empreinte = mw.text.split(empreinte, "/")
		local i = 1
		local init = true
		if empreinte[2]
		then table.insert(resultat, '<tr><th>Empreintes</th><td colspan="3">')
		else table.insert(resultat, '<tr><th>Empreinte</th><td colspan="3">')
		end
		while empreinte[i] do
			if init then init = false else table.insert(resultat, '<br/>') end
			table.insert(resultat, '[[Fichier:' .. empreinte[i] .. '.png|x22px|class=imagenoire]]')
			if empreinte[2] then table.insert(resultat, ' <i><small>(' .. nil_to_string(conditions_empreinte[i]).. ')</small></i>') end
			i = i + 1
		end
	end

	-- APPARENCE DU CORPS
	if corps == nil then corps = forme end
	if corps == nil or corps == '' or corps == '-'
	then table.insert(resultat, '<tr><th>[[Apparence du corps|Apparence<br/>du corps]]</th><td colspan="3">—')
		if categories_wiki
		then table.insert(resultat, "[[Catégorie:Pokémon dont l'apparence du corps est inconnue]]")
		end
	else corps = mw.text.split(corps, "/")
		local i = 1
		local init = true
		if corps[2]
		then table.insert(resultat, '<tr><th>[[Apparence du corps|Apparences<br/>du corps]]</th><td colspan="3">')
		else table.insert(resultat, '<tr><th>[[Apparence du corps|Apparence<br/>du corps]]</th><td colspan="3">')
		end
		while corps[i] do
			if init then init = false else table.insert(resultat, '<br/>') end
			table.insert(resultat, frame:expandTemplate{title='Apparence du corps', args={corps[i]}})
			if corps[2] then table.insert(resultat, ' <i><small>(' .. nil_to_string(conditions_corps[i]).. ')</small></i>') end
			i = i + 1
		end
	end
	table.insert(resultat, '</td></tr>')

	-- CRI
	if cri == '' then cri = nil end
	if cri == nil and not tonumber(ndex)
	then table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Cri]]</th></tr><tr><td colspan="4" style="text-align:center">—</td></tr>')
	elseif cri ~= nil
	then cri = mw.text.split(cri, "/")
		if cri[2]
		then table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Cri]]s</th></tr>')
		else table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Cri]]</th></tr>')
		end
		local i = 1
		while cri[i] do
			table.insert(resultat, '<tr><td colspan="4" style="text-align:center"><center>[[Fichier:' .. cri[i] .. '.ogg|noicon]]</center>')
			if cri[2] then table.insert(resultat, '<small><i>(' .. nil_to_string(conditions_cri[i]) .. ')</i></small>') end
			table.insert(resultat, '</td></tr>')
			i = i + 1
		end
	else table.insert(resultat, '<tr><th colspan="4" style="text-align:center">[[Cri]]</th></tr><tr><td colspan="4" style="text-align:center"><center>')
		table.insert(resultat, '[[Fichier:Cri ' .. ndex .. '.ogg|noicon]]')
		table.insert(resultat, '</center></td></tr>')
	end
	cri = nil

	-- GESTION CATÉGORISATION GÉNÉRATION ET DONNÉES
	table.insert(resultat, '<tr><td style="width:30%; height: 0px; padding: 0px;">')
	if categories_wiki
	then table.insert(resultat, '[[Catégorie:Pokémon]]')

		if generation == 1 then table.insert(resultat, '[[Catégorie:Pokémon de la première génération]]')
		elseif generation == 2 then table.insert(resultat, '[[Catégorie:Pokémon de la deuxième génération]]')
		elseif generation == 3 then table.insert(resultat, '[[Catégorie:Pokémon de la troisième génération]]')
		elseif generation == 4 then table.insert(resultat, '[[Catégorie:Pokémon de la quatrième génération]]')
		elseif generation == 5 then table.insert(resultat, '[[Catégorie:Pokémon de la cinquième génération]]')
		elseif generation == 6 then table.insert(resultat, '[[Catégorie:Pokémon de la sixième génération]]')
		elseif generation == 7 then table.insert(resultat, '[[Catégorie:Pokémon de la septième génération]]')
		elseif generation == 8 then table.insert(resultat, '[[Catégorie:Pokémon de la huitième génération]]')
		elseif generation == 9 then table.insert(resultat, '[[Catégorie:Pokémon de la neuvième génération]]')
		elseif generation == 10 then table.insert(resultat, '[[Catégorie:Pokémon de la dixième génération]]')
		end

		if fmratio == -1 then table.insert(resultat, '[[Catégorie:Pokémon asexué]]')
		elseif fmratio == 1 then table.insert(resultat, '[[Catégorie:Pokémon uniquement femelle]]')
		elseif fmratio == 0 then table.insert(resultat, '[[Catégorie:Pokémon uniquement mâle]]')
		end
	end

	if donnees
	then if generation == 1 then table.insert(resultat, '[[Génération du Pokémon::Première génération|]]')
		elseif generation == 2 then table.insert(resultat, '[[Génération du Pokémon::Deuxième génération|]]')
		elseif generation == 3 then table.insert(resultat, '[[Génération du Pokémon::Troisième génération|]]')
		elseif generation == 4 then table.insert(resultat, '[[Génération du Pokémon::Quatrième génération|]]')
		elseif generation == 5 then table.insert(resultat, '[[Génération du Pokémon::Cinquième génération|]]')
		elseif generation == 6 then table.insert(resultat, '[[Génération du Pokémon::Sixième génération|]]')
		elseif generation == 7 then table.insert(resultat, '[[Génération du Pokémon::Septième génération|]]')
		elseif generation == 8 then table.insert(resultat, '[[Génération du Pokémon::Huitième génération|]]')
		elseif generation == 9 then table.insert(resultat, '[[Génération du Pokémon::Neuvième génération|]]')
		elseif generation == 10 then table.insert(resultat, '[[Génération du Pokémon::Dixième génération|]]')
		end
	end

	table.insert(resultat, '</td><td style="width:20%; height: 0px; padding: 0px;"></td><td style="width:20%; height: 0px; padding: 0px;"></td><td style="width:30%; height: 0px; padding: 0px;"></td></tbody>')
	table.insert(resultat, '</table>')
	return table.concat(resultat, "")
end

return p