Movatterモバイル変換


[0]ホーム

URL:


Jump to content
ⵡⵉⴽⵉⴱⵉⴷⵢⴰ
ⴰⵔⵣⵣⵓ

Module:Check for unknown 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 listlocalp={}localfunctionisnotempty(s)returnsands:match('^%s*(.-)%s*$')~=''endfunctionp.check(frame)localargs=frame.argslocalpargs=frame:getParent().argslocalignoreblank=isnotempty(frame.args['ignoreblank'])localcheckpos=isnotempty(frame.args['checkpositional'])localknownargs={}localunknown='Found _VALUE_, 'localres={}-- create the list of known args, and the return stringfork,vinpairs(args)doiftype(k)=='number'thenv=mw.ustring.gsub(v,'^%s*(.-)%s*$','%1')knownargs[v]=1elseif(k=='unknown'andtype(v)=='string')thenunknown=vendendend-- loop over the parent args, and make sure they are on the listfork,vinpairs(pargs)doif(type(k)=='string'andknownargs[k]==nil)thenif((notignoreblank)or(ignoreblankandisnotempty(v)))thenk=mw.ustring.gsub(k,'[^%w\-_ ]','?')localr=mw.ustring.gsub(unknown,'_VALUE_',k)table.insert(res,r)endelseif(checkposandtype(k)=='number'andknownargs[tostring(k)]==nil)thenif((notignoreblank)or(ignoreblankandisnotempty(v)))thenlocalr=mw.ustring.gsub(unknown,'_VALUE_',k)table.insert(res,r)endendendreturntable.concat(res)endreturnp
ⵜⴻⵜⵜⵢⴰⵙⴰⵢ ⴷ ⵙⴳhttps://zgh.wikipedia.org/w/index.php?title=Module:Check_for_unknown_parameters&oldid=4694

[8]ページ先頭

©2009-2025 Movatter.jp