Modulo:mchkparametrojn: Malsamoj inter versioj

Enhavo forigita Enhavo aldonita
Taylor 49 (diskuto | kontribuoj)
d
Taylor 49 (diskuto | kontribuoj)
plibo
 
Linio 3:
MODULE "mchkparametrojn" (check parametrojn)
 
"eo.wiktionary.org/wiki/Modulo:mchkparametrojn" <!--2019-Jun-xx30-->
"id.wiktionary.org/wiki/Modul:mchkparametrojn"
 
Purpose: performs 2 comparisons in order to check validity
of the anonymous parameters submitted the caller, even empty
parameters can countbe accepted as valid withand thecounted "E"with option, otherwisethe
"E" option, otherwise they are considered as an error, can check availability
availability of obligatory named parameters too
 
Utilo: efektivigas 2 komparojn por kontroli validecon
de la anonimaj parametroj transdonitaj al la vokanto, ecx malplenaj
parametroj povas esti alsumigatajakceptitaj kunkiel lavalidaj "E"kaj opcio,alsumigataj alimanierekun la
"E" opcio, alimaniere ili estas pritraktataj kiel eraro, povas ankaux kontroli disponeblon
kontroli disponeblon de devigaj nomitaj parametroj
 
Manfaat: ...melaksanakan mengontrol2 parameterperbandingan dikirimuntuk kepada templatmengontrol ...
parameter anonim dikirim kepada pemanggil, bahkan parameter
kosong bisa ... dan dihitung dengan opsi "E" ... parameter bernama
 
Used by templates / Uzata far sxablonoj:
Linio 54 ⟶ 56:
<!--enkonduko#
#protekto-->{{#if:<!--o-->{{{1|}}}<!--o-->|<!--then-->{{#inv
oke:mwhineplendu|ek}}]<!--o-->|<!--else--><!--protekto#
#kerno-->"Hello world!" from template "contoh"<!--kerno#
#protekto-->}}<!--endif--><!--protekto#
Linio 83 ⟶ 85:
 
"{{#invoke:mchkparametrojn|ek|0|0|nama|umur}}"
 
"<!--enkonduko#
#protekto-->{{#ifeq:<!--o-->{{#invoke:mchkparamet
rojn|ek|1|2}}<!--o-->|<!--equal-->0<!--o-->|<!--then-->{{#invoke:mwhin
eplendu|ek}}<!--o-->}}<!--endif-->{{#ifeq:<!--o-->{{#invoke:mchkparamet
rojn|ek|1|2}}<!--o-->|<!--equal-->1<!--o-->|<!--then--><!--protekto#
#kerno-->"Hello world!" from template "contoh"<!--kerno#
#protekto-->}}<!--endif--><!--protekto#
#fino-->"
 
Notes about the examples of "protekto":
- In all 3 examples the "kerno" part is in the else-branch of an
if-structure. This means that the "kerno" part may NOT contain
unprotected walls "|", most notably "wikitables".
- The latter example invokes "mchkparametrojn" 2 times due to the risk
of "module failed to run". Make sure that both calls are identical.
 
]===]
Linio 254 ⟶ 272:
if (vartmp==nil) then
booerr = true
break -- expected named parameter NOT found, this is fatal
else
if ((booemp==false) and (vartmp=="")) then
booerr = true
break -- empty parameter found without "E", this is fatal too
end--if
end--if
Linio 272 ⟶ 290:
---- RETURN THE JUNK STRING ----
 
return strret -- can be emptyonly "0" or "1"
 
end--function