Movatterモバイル変換


[0]ホーム

URL:


Μετάβαση στο περιεχόμενο
ΒικιπαίδειαΗ Ελεύθερη Εγκυκλοπαίδεια
Αναζήτηση

Module:Check for unknown parameters

Από τη Βικιπαίδεια, την ελεύθερη εγκυκλοπαίδεια
Τεκμηρίωση module[δημιουργία] [ανανέωση]
Μπορείτε να συμβάλλετε στηδημιουργία σελίδας τεκμηρίωσης για αυτό τοScribunto module.
Οι συντάκτες μπορούν να πειραματίζονται στο πρόχειρο(δημιουργία |αντίγραφο) και στις δοκιμαστικές σελίδες(δημιουργία) του module.
Παρακαλούμε να προσθέτετε τις κατηγορίες στηνυποσελίδα τεκμηρίωσης.Υποσελίδες αυτού του module.
-- 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={}localfunctiontrim(s)returns:match('^%s*(.-)%s*$')endlocalfunctionisnotempty(s)returnsandtrim(s)~=''endfunctionp.check(frame)localargs=frame.argslocalpargs=frame:getParent().argslocalignoreblank=isnotempty(frame.args['ignoreblank'])localshowblankpos=isnotempty(frame.args['showblankpositional'])localknownargs={}localunknown=frame.args['unknown']or'Found _VALUE_, 'localpreview=frame.args['preview']localvalues={}localres={}localregexps={}-- create the list of known args, regular expressions, and the return stringfork,vinpairs(args)doiftype(k)=='number'thenv=trim(v)knownargs[v]=1elseifk:find('^regexp[1-9][0-9]*$')thentable.insert(regexps,'^'..v..'$')endendifisnotempty(preview)thenpreview='<div><strong>Προειδοποίηση:</strong> '..preview..' (αυτό το μήνυμα εμφανίζεται μόνο στην προεπισκόπηση).</div>'elseifpreview==nilthenpreview=unknownend-- loop over the parent args, and make sure they are on the listfork,vinpairs(pargs)doiftype(k)=='string'andknownargs[k]==nilthenlocalknownflag=falsefori,regexpinipairs(regexps)doifmw.ustring.match(k,regexp)thenknownflag=truebreakendendifnotknownflagand(notignoreblankorisnotempty(v))thenk=mw.ustring.gsub(k,'[^%w\-_ ]','?')table.insert(values,k)endelseiftype(k)=='number'andknownargs[tostring(k)]==niland(showblankposorisnotempty(v))thenlocalvlen=mw.ustring.len(v)v=mw.ustring.sub(v,1,(vlen<25)andvlenor25)v=mw.ustring.gsub(v,'[^%w\-_ ]','?')table.insert(values,k..' = '..v..((vlen>=25)and' ...'or''))endend-- add resuls to the output tablesif#values>0thenifframe:preprocess("{{REVISIONID}}")==""thenunknown=previewendfork,vinpairs(values)doifv==''then-- Fix odd bug for | = which gets stripped to the empty string and-- breaks category linksv=' 'endlocalr=unknown:gsub('_VALUE_',v)table.insert(res,r)endendreturntable.concat(res)endreturnp
Ανακτήθηκε από "https://el.wikipedia.org/w/index.php?title=Module:Check_for_unknown_parameters&oldid=9602492"

[8]ページ先頭

©2009-2025 Movatter.jp