Module:Liste de Pokémon
Apparence
Le module Liste de Pokémon permet de générer un tableau d'une liste de Pokémon, optimisé pour être utilisable dans un maximum de contextes.
Ce module contient une fonction unique "liste".
Paramètres
[modifier]Certains paramètres sont accompagnés d'une ou plusieurs icône indiquant leur(s) caractéristique(s) :
|
| Paramètre | Description |
|---|---|
| 1 | Nom de la fonction à appeler. indiquer liste pour afficher le numéro, la miniature et le nom des Pokémon, ou miniature pour 'n'afficher que leur miniature.
|
| 2 | Liste des Pokémon à afficher dans le tableau, séparés par un retour à la ligne. Des informations additionnelles, comme une forme particulière, peuvent être spécifiées, conformément à la nomenclature décrite sur Ressources/infosPokémon. Une nouvelle section du tableau peut également être commencée avec Section (nomSection).
|
| jeu |
À indiquer pour afficher les miniature d'un jeu ou d'une paire de jeux en particulier, en utilisant le Modèle:Jeu. |
| titre |
À indiquer pour changer le titre par défaut du tableau. |
| type |
À indiquer pour changer la couleur du tableau, lui faisant prendre l'apparence d'un type de Pokémon. Peut également être utilisé pour indiquer d'autres styles de tableau. |
| miniature |
Indiquer miniature=oui pour n'afficher que les miniatures des différents Pokémon.
|
Exemples
[modifier]{{#invoke:Liste de Pokémon|liste|
Créhelf
Bulbizarre
Pichu
Pikachu
Goupix forme(Alola)
Salarsen forme(Aigüe)
}}
donnera :
| Pokémon | |||
|---|---|---|---|
0480 Créhelf | 0001 Bulbizarre | 0172 Pichu | 0025 Pikachu |
0037 GoupixForme d'Alola | 0849 SalarsenForme Aigüe | ||
{{#invoke:Liste de Pokémon|liste|jeu=Sleep|titre=Exemple de tableau|
Créhelf
Bulbizarre
Pichu
Pikachu
Goupix forme(Alola)
Section Exemple de section
Salarsen forme(Aigüe)
}}
donnera :
| Exemple de tableau | |||
|---|---|---|---|
0001 Bulbizarre | 0172 Pichu | 0025 Pikachu | 0037 GoupixForme d'Alola |
| Exemple de section | |||
0849 SalarsenForme Aigüe | |||
{{#invoke:Liste de Pokémon|miniature|type=feu|
Créhelf
Bulbizarre
Pichu
Pikachu
Goupix forme(Alola)
Salarsen forme(Aigüe)
}}
donnera :
| Pokémon |
|---|
![]() ![]() ![]() ![]() ![]() ![]() |
local p = {}
local ressources = {
["infosPokemon"] = require("Module:Ressources/infosPokemon")
}
function p.liste(frame)
local jeu = frame.args["jeu"]
local pokemon = frame.args[1]
local titre = (frame.args["titre"] or "Pokémon")
local tableauType = (frame.args["type"] or "")
if pokemon ~= nil then pokemon = mw.text.split(pokemon, "\n") else pokemon = {} end
local resultat = {}
table.insert(resultat, '<table class="tableaustandard ' .. tableauType .. ' capacité-liste"><tr><th colspan="4">'.. titre ..'</th></tr><tr>')
local i = 1
local j = 1
while pokemon[i] do
if mw.text.trim(pokemon[i]) ~= "" then
if string.match(pokemon[i], "^Section ") then
pokemon[i] = string.gsub( pokemon[i], "Section ", "" )
table.insert(resultat, '</tr><tr>')
table.insert(resultat, '<th colspan="4">'.. pokemon[i] ..'</th></tr><tr>')
j = 1
else
if jeu then pokemon[i] = pokemon[i] .. 'jeu(' .. jeu .. ')' end
table.insert(resultat, '<td style="vertical-align:top; min-width:25%">')
table.insert(resultat, ressources.infosPokemon(pokemon[i]))
table.insert(resultat, '</td>')
if j == 4 then
j = 1
table.insert(resultat, '</tr><tr>')
else
j = j + 1
end
end
end
i = i + 1
end
table.insert(resultat, '</tr></table>')
return table.concat(resultat, '')
end
function p.miniature(frame)
local jeu = frame.args["jeu"]
local pokemon = frame.args[1]
local titre = (frame.args["titre"] or "Pokémon")
local tableauType = (frame.args["type"] or "")
if pokemon ~= nil then pokemon = mw.text.split(pokemon, "\n") else pokemon = {} end
local resultat = {}
table.insert(resultat, '<table class="tableaustandard ' .. tableauType .. ' centre"><tr><th>'.. titre ..'</th></tr><tr><td>')
local i = 1
while pokemon[i] do
if mw.text.trim(pokemon[i]) ~= "" then
if string.match(pokemon[i], "^Section ") then
pokemon[i] = string.gsub( pokemon[i], "Section ", "" )
table.insert(resultat, '</tr><tr>')
table.insert(resultat, '<th colspan="4">'.. pokemon[i] ..'</th></tr><tr><td>')
else
if jeu then pokemon[i] = pokemon[i] .. 'jeu(' .. jeu .. ')' end
table.insert(resultat, ressources.infosPokemon(pokemon[i], "miniature"))
end
end
i = i + 1
end
table.insert(resultat, '</td></tr></table>')
return table.concat(resultat, '')
end
return p










