« Module:Prononciation » : différence entre les versions
Contenu supprimé Contenu ajouté
corrige variables globales |
m indentation |
||
Ligne 3 :
function p.prononciation(frame) --récupère la prononciation telle qu'indiquée sur l'item
local parent = frame:getParent(frame) --récupère les paramètres passés au modèle
if (parent.args[2] and parent.args[2] ~= '') then --si le paramètre {{{2}}} existe (on présume que {{{1}}} existe du coup)
end
if (parent.args[1] and parent.args[1] ~= '') then --si le paramètre {{{1}}} existe — seul
end
local entity = mw.wikibase.getEntity() -- si aucun des paramètres n'existe, on charge l'item Wikidata associé à l'article
Ligne 16 :
return "[[Catégorie:Demande de prononciation audio]]"
end
local pron_fr = wikidataMod.formatStatements({entity=entity,property='P443',qualifier='P407',qualifiervalue='Q150'}) --récupère la prononciation en français
if not pron_fr then -- s'il n'y en a pas :
local pron = wikidataMod.formatStatements({entity=entity,property='P443',rank='best', numval=1}) --récupère la prononciation tout court
Ligne 31 :
end
function p.test
local parent = frame:getParent(frame)
if parent.args[2] then return parent.args[2] end
if parent.args[1] then return parent.args[1] end
return 'rien =/'
end
|