Module:Description
Utilisation
Ce module sert à générer automatiquement une description et une catégorisation pour certains ensembles de fichiers. L'application stricte des règles de nomenclature permet au module de détecter les bons éléments qui permettent de former la description.
Fonctions
Les fonctions permettent au module de savoir quel est le type de fichier qu'il traite, parmi les suivants :
- sprite ou miniature : les sprites et miniatures de Pokémon ;
- type : les miniatures de types.
Toutes les fonctions supportent les mêmes paramètres.
Paramètres
Certains paramètres sont accompagnés d'une ou plusieurs icône indiquant leur(s) caractéristique(s) :
|
- paramètre non nommé : permet de forcer le nom à partir duquel former la description. Par défaut, le nom est réglé sur celui de la page en cours (
{{PAGENAME}}
). - source : permet de rajouter une source pour le fichier. Des raccourcis sont disponibles.
- serebii : renvoie vers l'article Serebii du Pokémon en question. Supporte les jeux de la série principale et Pokémon GO.
- bluemoonfalls-stadium2 : Archive Stadium 2 sur Blue Moon Falls — utilisé pour les sprites de Pokémon Stadium 2.
- bulbapedia : Bulbapedia.
- drive smile : Dépôt Drive d'abcboy — utilisé pour les sprites de Pokémon Smile.
- elchicoeevee-unite : MEGA de ElChicoEevee — utilisé pour les sprites de Pokémon UNITE.
- elchicoeevee-sleep : @ElChicoEevee sur Twitter — utilisé pour les sprites de Pokémon Sleep.
- matt-home : @mattyoukhana_ sur Twitter — utilisé pour les sprites de Pokémon HOME.
- matt-home-v3 : @mattyoukhana_ sur Twitter — utilisé pour les sprites de la version 3.0.0 de Pokémon HOME.
- matt-home-v4 : @mattyoukhana_ sur Twitter — utilisé pour les sprites de la version 3.1.0 de Pokémon HOME.
- matt-npsnap : @mattyoukhana_ sur Twitter — utilisé pour les sprites de New Pokémon Snap.
- pokebip-remix : MEGA de Pokebip — utilisé pour les images de Pokémon Café ReMix.
- pokeminers : GitHub de PokeMiners — utilisé pour les sprites de Pokémon GO.
- sleepwiki : Pokémon Sleep Info Wiki — utilisé pour les images de Pokémon Sleep.
- wikidex : WikiDex.
- source-précisions : permet d'ajouter des précisions sur la source. Particulièrement utile quand le paramètre source est utilisé en tant que raccourci.
- Indiquer
source-précisions=Détourage Utilisateur
,source-précisions=Découpage Utilisateur
,source-précisions=Extraction Utilisateur
ousource-précisions=Recadrage Utilisateur
ajoutera une phrase pour indiquer un travail supplémentaire de l'utilisateur mentionné.
- Indiquer
- catégories : par défaut à oui, indiquer « non » permet d'éviter la catégorisation automatique de la page.
- données-sémantiques : par défaut à oui, indiquer « non » permet d'éviter l'ajout automatique de données sémantiques à la page.
- bandeau-versions : par défaut à oui, indiquer « non » permet d'éviter l'ajout automatique d'un bandeau permettant de naviguer entre les différentes versions du fichier.
Exemple
{{#invoke:Description|sprite}}
sur la page « Fichier:Sprite 0025 ♂ DP.png » donne :
Sprite de Pikachu mâle dans Pokémon Diamant et Perle.
et catégorise la page dans les catégories « Image Pokémon représentant Pikachu » et « Sprite Pokémon (Diamant et Perle) ».
Voir aussi
local p = {} local special_image_types = { Compagnon = "Sprite compagnon", ["Pokédex"] = "Image du Pokédex" } local image_type_to_category_type = { Compagnon = "Sprite Pokémon compagnon", Cri = "Cri Pokémon", Empreinte = "Empreinte de Pokémon", Empreintes = "Empreintes de Pokémon", Galerie = "Sprite Pokémon de la Galerie", ["Icône"] = "Icône Pokémon", Miniature = "Miniature Pokémon", ["Pokédex"] = "Image du Pokédex", Portrait = "Portrait Pokémon", Pose = "Pose Pokémon", Sprite = "Sprite Pokémon", } -- pour « Catégorie:Ancienne version *de sprite Pokémon* » local image_type_to_category_type_with_undefined_article = { Compagnon = "de sprite Pokémon compagnon", Cri = "de cri", Empreinte = "d'empreinte de Pokémon", Empreintes = "d'empreintes de Pokémon", Galerie = "de sprite Pokémon de la Galerie", ["Icône"] = "d'icône Pokémon", Miniature = "de miniature Pokémon", ["Pokédex"] = "d'image du Pokédex", Portrait = "de portrait Pokémon", Pose = "de pose Pokémon", Sprite = "de sprite Pokémon" } -- pour « Version 1 *du sprite* de Pikachu dans Pokémon Jaune » local image_type_with_articles = { Compagnon = "du sprite Pokémon compagnon", Cri = "du cri", Empreinte = "de l'empreinte", Empreintes = "des empreintes", Galerie = "de la galerie", ["Icône"] = "de l'icône", Miniature = "de la miniature", ["Pokédex"] = "de l'image du Pokédex", Portrait = "du portrait", Pose = "de la pose", Sprite = "du sprite" } local game_editor = { RV = "[[GAME FREAK (studio de développement)|GAME FREAK]]", RB = "[[GAME FREAK (studio de développement)|GAME FREAK]]", J = "[[GAME FREAK (studio de développement)|GAME FREAK]]", O = "[[GAME FREAK (studio de développement)|GAME FREAK]]", A = "[[GAME FREAK (studio de développement)|GAME FREAK]]", OA = "[[GAME FREAK (studio de développement)|GAME FREAK]]", C = "[[GAME FREAK (studio de développement)|GAME FREAK]]", RS = "[[GAME FREAK (studio de développement)|GAME FREAK]]", RFVF = "[[GAME FREAK (studio de développement)|GAME FREAK]]", E = "[[GAME FREAK (studio de développement)|GAME FREAK]]", DP = "[[GAME FREAK (studio de développement)|GAME FREAK]]", HGSS = "[[GAME FREAK (studio de développement)|GAME FREAK]]", ["Pokéwalker"] = "[[GAME FREAK (studio de développement)|GAME FREAK]]", Pt = "[[GAME FREAK (studio de développement)|GAME FREAK]]", NB = "[[GAME FREAK (studio de développement)|GAME FREAK]]", NB2 = "[[GAME FREAK (studio de développement)|GAME FREAK]]", N2B2 = "[[GAME FREAK (studio de développement)|GAME FREAK]]", XY = "[[GAME FREAK (studio de développement)|GAME FREAK]]", ROSA = "[[GAME FREAK (studio de développement)|GAME FREAK]]", SL = "[[GAME FREAK (studio de développement)|GAME FREAK]]", USUL = "[[GAME FREAK (studio de développement)|GAME FREAK]]", LGPE = "[[GAME FREAK (studio de développement)|GAME FREAK]]", EB = "[[GAME FREAK (studio de développement)|GAME FREAK]]", EBisa = "[[GAME FREAK (studio de développement)|GAME FREAK]]", EBtec = "[[GAME FREAK (studio de développement)|GAME FREAK]]", DEPS = "[[ILCA, Inc.]]", LPA = "[[GAME FREAK (studio de développement)|GAME FREAK]]", EV = "[[GAME FREAK (studio de développement)|GAME FREAK]]", EVmt = "[[GAME FREAK (studio de développement)|GAME FREAK]]", EVdi = "[[GAME FREAK (studio de développement)|GAME FREAK]]", LPZA = "[[GAME FREAK (studio de développement)|GAME FREAK]]", CM = "[[Genius Sonority]]", GO = "[[Niantic]]", HOME = "[[ILCA, Inc.]]", NPSnap = "[[Bandai Namco Studios]]", PM = "[[DeNA]]", RAdar = "[[GAME FREAK (studio de développement)|GAME FREAK]]", Smile = "[[The Pokémon Company]]", UNITE = "[[TiMi Studios]]", Sleep = "[[SELECT BUTTON Inc.]]", St1 = "[[HAL Laboratory, Inc.]]", St2 = "[[HAL Laboratory, Inc.]]" } -- info: egg, game, ndex function format_source(frame, source, source_precisions, info) local source_lowered = mw.ustring.lower(source) if source_lowered == "serebii" then serebii_urls = { RV = "pokedex/{ndex}.shtml", RB = "pokedex/{ndex}.shtml", J = "pokedex/{ndex}.shtml", O = "pokedex-gs/{ndex}.shtml", A = "pokedex-gs/{ndex}.shtml", OA = "pokedex-gs/{ndex}.shtml", RS = "pokedex-rs/{ndex}.shtml", RFVF = "pokedex-rs/{ndex}.shtml", E = "pokedex-rs/{ndex}.shtml", DP = "pokedex-dp/{ndex}.shtml", HGSS = "pokedex-dp/{ndex}.shtml", Pt = "pokedex-dp/{ndex}.shtml", NB = "pokedex-bw/{ndex}.shtml", NB2 = "pokedex-bw/{ndex}.shtml", XY = "pokedex-xy/{ndex}.shtml", ROSA = "pokedex-xy/{ndex}.shtml", SL = "pokedex-sm/{ndex}.shtml", USUL = "pokedex-sm/{ndex}.shtml", LGPE = "pokedex-sm/{ndex}.shtml", EB = "pokedex-swsh/{name_en}/", DEPS = "pokedex-swsh/{name_en}/", LPA = "pokedex-swsh/{name_en}/", EV = "pokedex-sv/{name_en}/", GO = "pokemongo/pokemon/{ndex}.shtml", UNITE = "pokemonunite/pokemon.shtml", -- "/{name_evo_en}.shtml", alolanninetales à gérer aussi } local end_url = serebii_urls[info.game] if end_url and info.ndex and not info.egg then local pokemon_names = mw.loadData("Module:Data/NomsPokémon") local name_en = mw.ustring.gsub(mw.ustring.lower(pokemon_names[tonumber(info.ndex)].en), " ", "") end_url = mw.ustring.gsub(end_url, "{ndex}", info.ndex) end_url = mw.ustring.gsub(end_url, "{name_en}", name_en) else end_url = "" end source = "[https://www.serebii.net/" .. end_url .. " Serebii]" end if source_lowered == "pkparaiso" then pkparaiso_urls = { XY = "xy/sprites_pokemon.php", ROSA = "rubi-omega-zafiro-alfa/sprites_pokemon.php", SL = "sol-luna/sprites_pokemon.php", USUL = "sol-luna/sprites_pokemon.php" } local end_url = pkparaiso_urls[info.game] if not end_url then end_url = "" end source = "[https://www.pkparaiso.com/" .. end_url .. " PkParaíso]" end local source_dict = { ["bluemoonfalls-stadium2"] = "[https://bluemoonfalls.com/pages/general/stadium-gif-archive Archive Stadium 2 sur Blue Moon Falls]", ["bulbapedia"] = "[https://bulbapedia.bulbagarden.net Bulbapedia]", ["drive smile"] = "[https://drive.google.com/file/d/1eQBdeXPNpLlaM9HUL8glsu224wGv7P0o/view?usp=sharing Dépôt Drive d'abcboy]", ["elchicoeevee-unite"] = "[https://mega.nz/folder/5FVhnBIY#ppNY0rlbUYggFccbGj_6qA MEGA de ElChicoEevee]", ["elchicoeevee-sleep"] = "[https://twitter.com/ElChicoEevee/status/1678350717034151936 @ElChicoEevee sur Twitter]", ["matt-home"] = "[https://twitter.com/mattyoukhana_/status/1527054730794614792 @mattyoukhana_ sur Twitter]", ["matt-home-v3"] = "[https://twitter.com/mattyoukhana_/status/1663359596860174336 @mattyoukhana_ sur Twitter]", ["matt-home-v4"] = "[https://twitter.com/mattyoukhana_/status/1702799273446756595 @mattyoukhana_ sur Twitter]", ["matt-npsnap"] = "[https://twitter.com/mattyoukhana_/status/1387946349715464198 @mattyoukhana_ sur Twitter]", ["pokebip-remix"] = "[https://mega.nz/folder/bQQSXDrS#nphWfJOwfBRtw2HyxW3Q6w MEGA de Pokebip]", ["pokeminers"] = "[https://github.com/PokeMiners/pogo_assets GitHub de PokeMiners]", ["sleepwiki"] = "[https://pks.raenonx.cc/en Pokémon Sleep Info Wiki]", ["wikidex"] = "[https://www.wikidex.net/wiki/WikiDex WikiDex]", } local source_shortcut = source_dict[source_lowered] if source_shortcut ~= nil then source = source_shortcut end if source_precisions then source_precisions_split = mw.text.split(source_precisions, " ") local precision_type = mw.ustring.lower(source_precisions_split[1]) if source_precisions_split[2] and (precision_type == "découpage" or precision_type == "détourage" or precision_type == "extraction" or precision_type == "recadrage") then local user = source_precisions_split[2] local u = 3 while source_precisions_split[u] do user = user .. " " .. source_precisions_split[u] u = u + 1 end local e = "" if precision_type == "extraction" then e = "e" end source = source .. ", " .. precision_type .. " réalisé" .. e .. " par " .. frame:expandTemplate{title="Ut", args={user}} .. "." else source = source .. ", " .. source_precisions end end local editor = game_editor[info.game] if editor then return "\n\n" .. frame:expandTemplate{title="Informations Fichier", args = {source = source, auteur = editor}} else return "\n\nSource : " .. source end end function p.sprite(frame) local result = {} local ressources = { ["de"] = require("Module:Ressources/de") } local special_forms = require("Module:Description/formesSpéciales") local pokemon_names = mw.loadData("Module:Data/NomsPokémon") local source = frame.args["source"] local categories = frame.args["catégories"] categories = (categories ~= "non") local bandeau_versions = frame.args["bandeau-versions"] -- bandeau_versions = (bandeau_versions ~= "non") bandeau_versions = (bandeau_versions == "oui") local semantic_data = frame.args["données-sémantiques"] -- semantic_data = (semantic_data ~= "non") semantic_data = (semantic_data == "oui") local bonus_categories = "" local title = frame.args[1] if title == nil then title = frame:getParent():getTitle() end local info_list = mw.text.split(title, " ") local info_list_length = 1 while info_list[info_list_length + 1] ~= nil do info_list_length = info_list_length + 1 end local image_type = mw.text.split(info_list[1], ":")[2] -- get rid of "File:" at the beginning local category_type = image_type_to_category_type[image_type] if category_type == nil then category_type = image_type_to_category_type["Sprite"] end local ndex = info_list[2] local egg = false if tonumber(ndex) == nil then if ndex == "Œuf" then egg = true ndex = "0000" else return "Erreur : le format du fichier n'est pas correct. Veuillez consulter [[Poképédia:Nomenclature des fichiers]] pour savoir comment nommer correctement un fichier de ce type.[[Catégorie:Sprite mal nommé]]" end end local name = pokemon_names[tonumber(ndex)] if name then name = name.fr else if egg then name = "Œuf" else return "Erreur : ce numéro national n'est pas reconnu.[[Catégorie:Sprite mal nommé]]" end end local game local version = nil local is_old_version = false local base_version_of_this = title local last_bit_split = mw.text.split(info_list[info_list_length], "-") -- handling the -v1, -CV sprites first if last_bit_split[2] then game = last_bit_split[1] version = mw.text.split(last_bit_split[2], "%.")[1] if version == "CV" then version = "[[Console Virtuelle]]" base_version_of_this = mw.ustring.gsub(title, "-CV", "") elseif version == "JP" then version = "japonaise" base_version_of_this = mw.ustring.gsub(title, "-JP", "") elseif mw.ustring.sub(version, 1, 1) == "v" and tonumber(mw.ustring.sub(version, 2, 2)) then version = mw.ustring.sub(version, 2) is_old_version = true base_version_of_this = mw.ustring.gsub(title, "-v" .. version, "") end else game = mw.text.split(info_list[info_list_length], "%.")[1] -- get rid of the file extension, .png, .gif... end local base_version_of_this_without_prefix = mw.ustring.gsub(base_version_of_this, "Fichier:", "") local game_to_game_long = require("Module:Data/NomsJeux") local game_long = game_to_game_long[game] if game_long == nil -- debug then return "Erreur : le jeu en question n'est pas supporté.[[Catégorie:Sprite mal nommé]]" end local info_indix_beginning = 3 -- first element is File:Image_type and second is ndex local info_indix_end = info_list_length - 1 -- -1 because the last element is games.file_extension local special_form_name = nil -- form suffixes local mirror_description = "" local mirror_category = "" if info_indix_beginning <= info_indix_end and info_list[info_indix_end] == "miroir" then mirror_description = " miroir" mirror_category = " miroir" info_indix_end = info_indix_end - 1 end local direction_description = "" if info_indix_beginning <= info_indix_end and (info_list[info_indix_end] == "nord" or info_list[info_indix_end] == "sud" or info_list[info_indix_end] == "est" or info_list[info_indix_end] == "ouest") then direction_description = " " .. info_list[info_indix_end] info_indix_end = info_indix_end - 1 end local back_description = "" local back_category = "" if info_indix_beginning <= info_indix_end and info_list[info_indix_end] == "dos" then back_description = "de dos" back_category = " de dos" info_indix_end = info_indix_end - 1 end local shiny_description = "" local shiny_category = "" if info_indix_beginning <= info_indix_end and info_list[info_indix_end] == "chromatique" then shiny_description = " [[chromatique]]" shiny_category = " chromatique" info_indix_end = info_indix_end - 1 end local gender = "" if info_indix_beginning <= info_indix_end and info_list[info_indix_end] == "♂" then gender = " mâle" info_indix_end = info_indix_end - 1 end if info_indix_beginning <= info_indix_end and info_list[info_indix_end] == "♀" then gender = " femelle" info_indix_end = info_indix_end - 1 end if egg and info_indix_beginning <= info_indix_end + 1 and info_list[info_indix_beginning] == "de" and info_list[info_indix_beginning + 1] == "Manaphy" then name = "Œuf de Manaphy" info_indix_beginning = info_indix_beginning + 2 end -- generic prefix forms if info_indix_beginning <= info_indix_end then local switch = { ["Alola"] = function() name = name .. " d'Alola" end, ["Galar"] = function() name = name .. " de Galar" end, ["Hisui"] = function() name = name .. " de Hisui" end, ["Paldea"] = function() name = name .. " de Paldea" end, ["Méga"] = function() name = "Méga-" .. name if info_indix_beginning + 1 <= info_indix_end -- Méga X et Méga Y then if info_list[info_indix_beginning + 1] == "X" -- Méga X then name = name .. " X" info_indix_beginning = info_indix_beginning + 1 end if info_list[info_indix_beginning + 1] == "Y" -- Méga Y then name = name .. " Y" info_indix_beginning = info_indix_beginning + 1 end end end, ["Primo"] = function() name = "Primo-" .. name end, ["Gigamax"] = function() name = name .. " Gigamax" end } local f = switch[info_list[info_indix_beginning]] if f then f() info_indix_beginning = info_indix_beginning + 1 end end -- generic suffix forms local generic_name_suffix = "" if info_indix_beginning <= info_indix_end then local switch = { ["Dominant"] = function() generic_name_suffix = " [[Pokémon Dominant (Alola)|Dominant]]" end, ["Monarque"] = function() generic_name_suffix = " [[Pokémon monarque|monarque]]" end } local f = switch[info_list[info_indix_end]] if f then f() info_indix_end = info_indix_end - 1 end end -- pokémon-specific form names if info_indix_beginning <= info_indix_end then local switch = { ["0000"] -- Œuf = "", ["0128"] -- Tauros = " Race", ["0129"] -- Magicarpe = " Motif", ["0412"] -- Cheniti = " Cape", ["0413"] -- Cheniselle = " Cape", ["0421"] -- Ceriflor = " Temps", ["0422"] -- Sancoki = " Mer", ["0423"] -- Tritosor = " Mer", ["0479"] -- Motisma = "", ["0493"] -- Arceus = " type", ["0550"] -- Bargantua = " Motif", ["0646"] -- Kyurem = " Mode", ["0666"] -- Prismillon = " Motif", ["0669"] -- Flabébé = " Fleur", ["0671"] -- Florges = " Fleur", ["0710"] -- Pitrouille = " Taille", ["0711"] -- Banshitrouye = " Taille", ["0716"] -- Xerneas = " Mode", ["0720"] -- Hoopa = "", ["0741"] -- Plumeline = " Style", ["0877"] -- Morpeko = " Mode", ["0892"] -- Shifours = " Style", ["0893"] -- Zarude = "", ["0925"] -- Famignol = " Famille de", ["0931"] -- Tapatoès = " Plumage", ["1008"] -- Miraidon = " Mode", } special_form_name = switch[ndex] end -- very special forms local has_form = info_indix_beginning <= info_indix_end local form = "" if has_form then form = info_list[info_indix_beginning] for j = info_indix_beginning + 1, info_indix_end do form = form .. " " .. info_list[j] end else form = nil end local games_with_parentheses_form_notation = {"CM", "Sh", "UNITE", "Sleep"} local games_with_blank_form_notation = {"UNITE"} function dans_sa_forme(form) return " dans sa [[forme]] " .. form end if has_form then local i = 1 while games_with_parentheses_form_notation[i] do if game == games_with_parentheses_form_notation[i] then function dans_sa_forme(form) return " (" .. form .. ")" end if categories and game == "CM" and image_type == "Sprite" and ndex ~= "0492" and ndex ~= "0869" and ndex ~= "0978" and ndex ~= "0999" then bonus_categories = bonus_categories .. "[[Catégorie:Image de tenue de Pokémon Café ReMix]]" end break end i = i + 1 end i = 1 while games_with_blank_form_notation[i] do if game == games_with_blank_form_notation[i] then function dans_sa_forme(form) return " " .. form end break end i = i + 1 end end local special_forms_result = special_forms(ndex, name, form, special_form_name, info_indix_beginning, info_indix_end, game) form = "" info_indix_beginning = special_forms_result.info_indix_beginning info_indix_end = special_forms_result.info_indix_end name = special_forms_result.name special_form_name = special_forms_result.special_form_name local name_category = special_forms_result.name_category local name_prefix = special_forms_result.name_prefix local name_suffix = special_forms_result.name_suffix local special_form_as_name_suffix = special_forms_result.special_form_as_name_suffix local form_between_commas = special_forms_result.form_between_commas if egg and (name_prefix == nil or name_prefix == "") then name_prefix = "un " end local comma_description = "" if form_between_commas == "" then comma_description = back_description else if back_description == "" then comma_description = form_between_commas else comma_description = form_between_commas .. ", " .. back_description end end if comma_description ~= "" then comma_description = ", " .. comma_description .. "," end -- construction of the form local form_init = false if special_form_name ~= nil then form = special_form_name form_init = true end if form_init then function dans_sa_forme(form) return form end end local form_suffix = "" for j = info_indix_beginning, info_indix_end do if info_list[j] ~= "" then if not form_init then form_suffix = form_suffix .. info_list[j] form_init = true else form_suffix = form_suffix .. " " .. info_list[j] end end end if form_suffix ~= "" then form = form .. dans_sa_forme(form_suffix) end if name_suffix == "" and special_form_name ~= nil and special_form_as_name_suffix then name_suffix = form form = "" end local sentence_beginning if version then -- Établissement des valeurs sémantiques pour les anciennes versions de fichier, afin de pouvoir remplir automatiquement le bandeau de navigation if semantic_data then mw.smw.set({ ["Version actuelle du fichier"] = base_version_of_this_without_prefix, ["Numéro de version"] = version }) end local image_type_with_article = image_type_with_articles[image_type] if image_type_with_article then sentence_beginning = "Version " .. version .. " " .. image_type_with_article else sentence_beginning = "Version " .. version .. " " .. ressources.de(image_type) .. mw.ustring.lower(image_type) end else sentence_beginning = special_image_types[image_type] if not sentence_beginning then sentence_beginning = image_type end end -- Bandeau de navigation entre les différentes versions du fichier, via requête sémantique if bandeau_versions then local version_navigation = {} table.insert(version_navigation, '<div style="border:1px solid #88a; background:#f8f8ff; text-align:center; margin: 0.5em 0; padding:0.5em; clear:both"><b>Versions du fichier</b><br>') local version_ask = mw.smw.ask("[[Version actuelle du fichier::" .. base_version_of_this_without_prefix .. "]]|?Numéro de version|sort=Numéro de version|order=asc") if version_ask then local version_iterator = 1 while version_ask[version_iterator] do local filename = mw.ustring.gsub(version_ask[version_iterator][1], "%|.*", "") filename = mw.ustring.gsub(filename, "%[%[", "[[:") table.insert(version_navigation, filename .. "|Version " .. version_ask[version_iterator]["Numéro de version"] .. "]] • ") version_iterator = version_iterator + 1 end table.insert(version_navigation, "[[:" .. base_version_of_this .. "|Version actuelle]]</div>\n") table.insert(result, table.concat(version_navigation, "")) end end -- Description principale local article_game = "" if game == "Pokéwalker" then article_game = "le " end table.insert(result, sentence_beginning .. direction_description .. mirror_description .. " " .. ressources.de(name_prefix .. name) .. name_prefix .. "[[" .. name .. "]]" .. generic_name_suffix .. name_suffix .. gender .. shiny_description .. form .. comma_description .. " dans " .. article_game .. frame:expandTemplate{title="Jeu", args={game}} .. ".") if source then local info = {egg = egg, game = game, ndex = ndex} local source_precisions = frame.args["source-précisions"] local formatted_source = format_source(frame, source, source_precisions, info) table.insert(result, formatted_source) end if categories then local category_beginning if is_old_version then local category_type_with_undefined_article = image_type_to_category_type_with_undefined_article[image_type] if category_type_with_undefined_article then category_beginning = "Ancienne version " .. category_type_with_undefined_article else category_beginning = "Ancienne version " .. ressources.de(category_type) .. mw.language.getContentLanguage():lcfirst(category_type) end else category_beginning = category_type end table.insert(result, "[[Catégorie:" .. category_beginning .. mirror_category .. shiny_category .. back_category .. " (" .. game_long .. ")|" .. ndex .. "]]") if image_type == "Cri" then table.insert(result, "[[Catégorie:Cri " .. ressources.de(name_category) .. name_category .. "|" .. ndex .. "]]") else if egg then table.insert(result, "[[Catégorie:" .. image_type .. " d'Œuf]]") else table.insert(result, "[[Catégorie:Image Pokémon représentant " .. name_category .. "]]") end end table.insert(result, bonus_categories) end return table.concat(result, "") end function p.miniature(frame) return p.sprite(frame) end function p.type(frame) local result = {} local source = frame.args["source"] local categories = frame.args["catégories"] categories = (categories ~= "non") local title = frame.args[1] if title == nil then title = frame:getParent():getTitle() end local info_list = mw.text.split(title, " ") local info_list_length = 1 while info_list[info_list_length + 1] ~= nil do info_list_length = info_list_length + 1 end local image_type = mw.text.split(info_list[1], ":")[2] -- get rid of "File:" at the beginning local name = info_list[3] local tera = "" if name == "Téracristal" then tera = "[[" .. name .. "]] " name = info_list[4] end local game local version = nil local last_bit_split = mw.text.split(info_list[info_list_length], "-") -- handling the -v1 sprites first if last_bit_split[2] then game = last_bit_split[1] version = mw.text.split(last_bit_split[2], "%.")[1] if mw.ustring.sub(version, 1, 1) == "v" and tonumber(mw.ustring.sub(version, 2, 2)) then version = mw.ustring.sub(version, 2) end else game = mw.text.split(info_list[info_list_length], "%.")[1] -- get rid of the file extension, .png, .gif... end local game_to_game_long = require("Module:Data/NomsJeux") local game_long = game_to_game_long[game] if game_long == nil -- debug then return "Erreur : le jeu en question n'est pas supporté.[[Catégorie:Sprite mal nommé]]" end if game ~= "LPA" and game ~= "NPSnap" then if game == "LGPE" then game_long = "Pokémon : " .. game_long else game_long = "Pokémon " .. game_long end end local info_indix_beginning = 3 -- first element is File:Image_type, second is the word "type", third is the actual type local info_indix_end = info_list_length - 1 -- last element is games.file_extension -- special suffixes local name_suffix = "" if info_indix_beginning <= info_indix_end and info_list[info_indix_end] == "Pokédex" then name_suffix = " dans le Pokédex" info_indix_end = info_indix_end - 1 end local sentence_beginning if version then local image_type_with_article = image_type_with_articles[image_type] if image_type_with_article then sentence_beginning = "Version " .. version .. " " .. image_type_with_article else sentence_beginning = "Version " .. version .. " de " .. image_type end else sentence_beginning = image_type end table.insert(result, sentence_beginning .. " du type " .. tera .. "[[" .. name .. " (type)|" .. name .. "]]" .. name_suffix .. " dans " .. frame:expandTemplate{title="Jeu", args={game}} .. ".") if source then local info = {egg = egg, game = game, ndex = ndex} local source_precisions = frame.args["source-précisions"] local formatted_source = format_source(frame, source, source_precisions, info) table.insert(result, formatted_source) end if categories then table.insert(result, "[[Catégorie:Image de type de " .. game_long .. "]]") end return table.concat(result, "") end return p