မေႃႇၵျူး:Check for unknown parameters
ၽိုၼ်ၵႅမ်မိုဝ်း မေႃႇၵျူး
Module:Check for unknown parameters is used to check for uses of unknown parameters in a template or module. It may be appended to a template at the end or called directly from a module.
လွင်ႈၸႂ်ႉတိုဝ်း
မႄးထတ်းFrom a template
မႄးထတ်းTo sort entries into a tracking category by parameter, use:
{{#invoke:Check for unknown parameters|check|unknown=[[Category:Some tracking category|_VALUE_]]|arg1|arg2|arg3|argN}}
To sort the entries into a tracking category by parameter with a preview error message, use:
{{#invoke:Check for unknown parameters|check|unknown=[[Category:Some tracking category|_VALUE_]]|preview=unknown parameter "_VALUE_"|arg1|arg2|...|argN}}
For an explicit red error message, use:
{{#invoke:Check for unknown parameters|check|unknown=<span class="error">Sorry, I don't recognize _VALUE_</span>|arg1|arg2|...|argN}}
To use Lua patterns, use:
{{#invoke:Check for unknown parameters|check|unknown=[[Category:Some tracking category|_VALUE_]]|preview=unknown parameter "_VALUE_"|arg1|arg2|...|argN|regexp1=header[%d]+|regexp2=date[1-9]}}
From a module
မႄးထတ်းTo call from a module, use:
local checkForUnknownParameters = require("Module:Check for unknown parameters")local result = checkForUnknownParameters._check(validArgs, args)
Where the first set of args are the module args below and the second set of args are the parameters that are checked.
ပႃႇရႃႇမီႇတႃႇ
မႄးထတ်းarg1
,arg2
, ...,argN
, are the known parameters.- Unnamed (positional) parameters can be added too:
|1|2|arg1|arg2|...
. - Lua patterns (similar to regular expressions) usage with parameters is also supported (such as:
|regexp1=header[%d]+
,|regexp2=date[1-9]
,|regexp3=data[%d]+[abc]?
). This is useful when there are many known parameters which use a systematic pattern. |unknown=
– what happens when an unknown parameter is used. Typically use either a tracking category to place pages that use unknown parameters, or an error.|preview=
– the text to be displayed when in preview mode and an unknown parameter is used.- The
_VALUE_
keyword, if used, will be changed to the name of the parameter. This is useful for either sorting the entries in a tracking category, or for provide more explicit information. |ignoreblank=1
– by default, the module makes no distinction between a defined-but-blank parameter and a non-blank parameter. That is, both unlisted|foo=x
and|foo=
are reported. To only track non-blank parameters use|ignoreblank=1
.|showblankpositional=1
– by default, the module ignores blank positional parameters. That is, an unlisted|2=
is ignored. To include blank positional parameters in the tracking use|showblankpositional=1
.
တူဝ်ယၢင်ႇ
မႄးထတ်း{{Infobox| above = {{{name|}}}| label1 = Height| data1 = {{{height|}}}| label2 = Weight| data2 = {{{weight|}}}| label3 = Website| data3 = {{{website|}}}}}<!-- end infobox, start tracking-->{{#invoke:Check for unknown parameters|check| unknown = {{Main other|[[Category:Some tracking category|_VALUE_]]}}| preview = unknown parameter "_VALUE_" | height | name | website | weight }}
Call from within Lua code
မႄးထတ်းSee the end of Module:Rugby box for a simple example or Module:Infobox3cols or Module:Flag for more complicated examples.
တူၺ်းပႃး
မႄးထတ်း- Category:Unknown parameters (0) (category page can have header {{Unknown parameters category}})
- Module:Params – for complex operations involving parameters
- Template:Checks for unknown parameters – adds documentation to templates using this module
- Module:Check for deprecated parameters – similar module that checks for deprecated parameters
- Module:Check for clobbered parameters – module that checks for conflicting parameters
- Module:TemplatePar – similar function (originally from dewiki)
- Template:Parameters and Module:Parameters – generates a list of parameter names for a given template
- Project:TemplateData based template parameter validation
- Module:Parameter validation checks a lot more
- User:Bamyers99/TemplateParametersTool - A tool for checking usage of template parameters
-- This module may be used to compare the arguments passed to the parent-- with a list of arguments, returning a specified result if an argument is-- not on the listrequire ('strict');local p = {}local function trim(s)return s:match('^%s*(.-)%s*$')endlocal function isnotempty(s)return s and s:match('%S')endlocal function clean(text)-- Return text cleaned for display and truncated if too long.-- Strip markers are replaced with dummy text representing the original wikitext.local pos, truncatedlocal function truncate(text)if truncated thenreturn ''endif mw.ustring.len(text) > 25 thentruncated = truetext = mw.ustring.sub(text, 1, 25) .. '...'endreturn mw.text.nowiki(text)endlocal parts = {}for before, tag, remainder in text:gmatch('([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()') dopos = remaindertable.insert(parts, truncate(before) .. '<' .. tag .. '>...</' .. tag .. '>')endtable.insert(parts, truncate(text:sub(pos or 1)))return table.concat(parts)endfunction p._check(args, pargs)if type(args) ~= "table" or type(pargs) ~= "table" then-- TODO: error handlingreturnend-- create the list of known args, regular expressions, and the return stringlocal knownargs = {}local regexps = {}for k, v in pairs(args) doif type(k) == 'number' thenv = trim(v)knownargs[v] = 1elseif k:find('^regexp[1-9][0-9]*$') thentable.insert(regexps, '^' .. v .. '$')endend-- loop over the parent args, and make sure they are on the listlocal ignoreblank = isnotempty(args['ignoreblank'])local showblankpos = isnotempty(args['showblankpositional'])local values = {}for k, v in pairs(pargs) doif type(k) == 'string' and knownargs[k] == nil thenlocal knownflag = falsefor _, regexp in ipairs(regexps) doif mw.ustring.match(k, regexp) thenknownflag = truebreakendendif not knownflag and ( not ignoreblank or isnotempty(v) ) thentable.insert(values, clean(k))endelseif type(k) == 'number' and knownargs[tostring(k)] == nil thenlocal knownflag = falsefor _, regexp in ipairs(regexps) doif mw.ustring.match(tostring(k), regexp) thenknownflag = truebreakendendif not knownflag and ( showblankpos or isnotempty(v) ) thentable.insert(values, k .. ' = ' .. clean(v))endendend-- add results to the output tableslocal res = {}if #values > 0 thenlocal unknown_text = args['unknown'] or 'Found _VALUE_, 'if mw.getCurrentFrame():preprocess( "{{REVISIONID}}" ) == "" thenlocal preview_text = args['preview']if isnotempty(preview_text) thenpreview_text = require('Module:If preview')._warning({preview_text})elseif preview_text == nil thenpreview_text = unknown_textendunknown_text = preview_textendfor _, v in pairs(values) do-- Fix odd bug for | = which gets stripped to the empty string and-- breaks category linksif v == '' then v = ' ' end-- avoid error with v = 'example%2' ("invalid capture index")local r = unknown_text:gsub('_VALUE_', {_VALUE_ = v})table.insert(res, r)endendreturn table.concat(res)endfunction p.check(frame)local args = frame.argslocal pargs = frame:getParent().argsreturn p._check(args, pargs)endreturn p
🔥 Top keywords: ၼႃႈႁူဝ်ႁႅၵ်ႈပၢင်ၵုမ်ၶွၼ်ႇၾရႅၼ်ႉလိၵ်ႈလူင်တၢင်းၵိၼ် ဢၼ်ဢမ်ႇလီၵိၼ် ၵိုၵ်းၵၼ်ထႅမ်းပလဵတ်ႉ:ၸႄႈမိူင်းတႆးတူၼ်ႈတီးမိူင်းထႆးမိူင်းမၢၼ်ႈၶိုၵ်ႉတွၼ်း:သွၵ်ႈႁႃပႃႉၺၢၼ်ႇ၊ လုင်း၊ ၶူးမေႃယႃလူင်ပိုၼ်းလိၵ်ႈတႆးမိူင်းၼၢႆး၊ ၸႄႈဝဵင်းမိူင်းတႆးဝီႇၶီႇၽီးတီးယႃး:လွင်ႈဝႅပ်ႉသၢႆႉထီးသႅင်၊ ၸၢႆး၊ ၽူႈႁွင်ႉၵႂၢမ်းငဝ်ႈႁၢၵ်ႈတၢင်းတူၵ်းတႅမ်ႇတႆးပီႇလ်ၵဵၵ်ႉထႅမ်းပလဵတ်ႉ:ၸႄႈတိူင်းတႃႈလိူဝ်ႇလိၵ်ႈတႆးၼမ်ႉၵဵဝ်တႃႈလိူဝ်ႇ၊ ဝဵင်းတႃႈၵုင်ႈ၊ ဝဵင်းထႅမ်းပလဵတ်ႉ:Infobox countryထႅမ်းပလဵတ်ႉ:Infobox ပိုၼ်းၵႅပ်ႈထႅမ်းပလဵတ်ႉ:Wikipedia's sister projectsမူး၊ ၸၢႆး၊ ၽူႈႁွင်ႉၵႂၢမ်း၊ ၽူႈတႅမ်ႈၵႂၢမ်းၸၢမ်ႇထုၼ်း၊ ၸဝ်ႈ၊ ၸဝ်ႈၾႃႉမိူင်းပွၼ်ၼပူဝ်းလီးယၼ်းၶိုၵ်ႉတွၼ်း:လွင်ႈလႅၵ်ႈလၢႆႈမႂ်ႇမႂ်ႇမေႃႇလမႅင်ႇ၊ ဝဵင်းပၢႆးမေႃၽၢႆႇဢၢႆႇထီႇလႄႈ သုၼ်ႇၵၢၼ်ငၢၼ်းပတဵင်ႇ၊ ဝဵင်းမိူင်းၼၢႆး၊ ဝဵင်းထႅမ်းပလဵတ်ႉ:ဝၼ်းလိူၼ်ပိူင်ထၢၼ်ႈ:Pages using ISBN magic linksလွင်ႈၼႄၵၢင်ၸႂ် တီႈမိူင်းမျၢၼ်ႇမႃႇ 2021မိူင်းလၢဝ်းပိူင်ထၢၼ်ႈ:ၵူၼ်းၸိူဝ်းၵိူတ်ႇ ပီ 1574ထႅမ်းပလဵတ်ႉ:ၵဵဝ်ႇလူၺ်ႈပိုၼ်းပၢႆးမိူင်း မိူင်းမျၢၼ်ႇမႃႇထေႇရဝႃႇတထူဝ်ႇၽူးသျဵၵ်းသႃႇပီႇယႃးပိူင်ထၢၼ်ႈ:ၵူၼ်းၸိူဝ်းသဵင်ႈၵၢမ်ႇ ပီ 1557ပုင်ႇပႃႇၶႅမ်၊ ဝဵင်းပၢႆးမိူင်း မိူင်းမၢၼ်ႈတႆးပႃႇတီႇမႂ်ႇသုင်ၸိုင်ႈတႆး - တပ်ႉသိုၵ်းၸိုင်ႈတႆးသိူဝ်ပၢင်ႇဢူး၊ ဝဵင်းမိူင်းႁူမ်ႈတုမ် ဢမႄႇရိၵတႃႈလိူဝ်ႇ၊ ၸႄႈတိူင်းထႅမ်းပလဵတ်ႉ:POTD/selectionထႅမ်းပလဵတ်ႉ:Topicsၸဝ်ႈသြႃႇ သုၶမ်းတၢင်းပဵၼ် ဝၢႆးရႅတ်ႉၶူဝ်ႇရူဝ်ႇၼႃႇ 2019တီႇယေးၵူဝ်း မႃရႃတူဝ်ၼႃႇဢေးသျႃးၸဵင်ႇၸၢၼ်းဝၼ်းဢွၵ်ႇပွၵ်ႉၸိူဝ်းမီးၼႂ်း မိူင်းမျၢၼ်ႇမႃႇတၢင်းၵိၼ်တႆးပိူင်ထၢၼ်ႈ:ၵူၼ်းၸိူဝ်းၵိူတ်ႇ ပီ 1491မိူင်းမၢဝ်းလူင်ပၢႆးမၢၵ်ႈမီးၸၼ်ႇဝႃႇရီႇထႅမ်းပလဵတ်ႉ:ၸႄႈမိူင်းလႄႈၸႄႈတိူင်း မိူင်းမျၢၼ်ႇမႃႇထဝိတ်ႉတႃႇပၢင်တိုၵ်းမိူင်းမၢဝ်းလူင်ထႅမ်းပလဵတ်ႉ:ၸႄႈဝဵင်းမျဵၵ်ႉမေႃႇၵျူး:Langၸၢႆးသၢႆမၢဝ်းထႅမ်းပလဵတ်ႉ:လိူၼ်ဢိင်းၵလဵတ်ႈပိူင်ထၢၼ်ႈ:ပွင်ႈၵႂၢမ်းပွတ်း ပထဝီႇ မိူင်းမျၢၼ်ႇမႃႇမိူင်းမေႃႇရီႇတေးၼီးယႃးတူၼ်ၶူးလူင် ၸဝ်ႈၼရၼႃႇထထႅမ်းပလဵတ်ႉ:ၸႄႈဝဵင်းမလႅင်ႇမိူင်းဢိၼ်းတီးယႃးထႅမ်းပလဵတ်ႉ:ၸႄႈတိူင်းမၵူၺ်းၸုမ်းၶိူဝ်းတႆးမူႇၸေႈ၊ ၸႄႈတွၼ်ႈမိူင်းဢိၼ်ႇတူဝ်ႇၼီးသျႃးၸူဝ်းသျႃး ၼႄႇလ်သၼ်ႇ ၶူႇသျိင်းပပ်ႉသႅၼ်သမ်ႇပၢင်လူင်၊ ဝဵင်းထႅမ်းပလဵတ်ႉ:Translation neededထိၼ်ႇၵျေႃႇ၊ ဢူးဢေးသျႃးထႅမ်းပလဵတ်ႉ:ၸႄႈတိူင်းၸႄႈၵႅင်းလိၵ်ႈဢင်းၵိတ်ႉတႃႈၵုင်ႈ၊ ၸႄႈတိူင်းမၢၼ်ႈပဵင်း၊ ၸႄႈဝဵင်းမိူင်းသၢတ်ႇ၊ ၸႄႈဝဵင်းပီႁူဝ်ပၢၵ်ႇ 19ဝီႇၶီႇၽီးတီးယႃး:ၵၢၼ်ထဵင်ၶိုၼ်းၵူႈလွင်ႈလွင်ႈမိူင်းၶူၵ်ႉ၊ ဝဵင်းပျေႃႇပွႆႇ၊ ဝဵင်းတၢင်ႉယၢၼ်း၊ ၸႄႈဝဵင်းပၢင်းတရႃႉ၊ ဝဵင်းမိူင်းဢင်းၵိတ်ႉမိူင်းၶၢၵ်ႇ၊ ၸႄႈဝဵင်းဝီႇၶီႇၽီးတီးယႃးမိူင်းသူႈ၊ ဝဵင်း