http://proplan.55bet-pro.com/wiki/index.php?action=history&feed=atom&title=M%C3%B3dulo%3ACheck_for_unknown_parameters Módulo:Check for unknown parameters - Histórico de revisão-55BET Pro 2026-03-15T15:59:47Z Histórico de revisões para esta página neste wiki MediaWiki 1.42.7 http://proplan.55bet-pro.com/wiki/index.php?title=M%C3%B3dulo:Check_for_unknown_parameters&diff=69&oldid=prev Módulo:Check for unknown parameters - Histórico de revisão-55BET Pro 2024-06-27T11:11:54Z <p>uma edição</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="pt-BR"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Edição anterior</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Edição das 08h11min de 27 de junho de 2024</td> </tr><tr><td colspan="2" class="diff-notice" lang="pt-BR"><div class="mw-diff-empty">(Sem diferença)</div> </td></tr></table> Henryzord http://proplan.55bet-pro.com/wiki/index.php?title=M%C3%B3dulo:Check_for_unknown_parameters&diff=68&oldid=prev Módulo:Check for unknown parameters - Histórico de revisão-55BET Pro 2022-02-21T05:24:13Z <p>Changed protection settings for &quot;<a href="/wiki/M%C3%B3dulo:Check_for_unknown_parameters" title="Módulo:Check for unknown parameters">Module:Check for unknown parameters</a>&quot;: <a href="/wiki/index.php?title=WP:High-risk_templates&amp;action=edit&amp;redlink=1" class="new" title="WP:High-risk templates (página inexistente)">Highly visible template</a>; requested at <a href="/wiki/index.php?title=WP:RfPP&amp;action=edit&amp;redlink=1" class="new" title="WP:RfPP (página inexistente)">WP:RfPP</a> ([Edit=Require administrator access] (indefinite) [Move=Require administrator access] (indefinite))</p> <p><b>Página nova</b></p><div>-- This module may be used to compare the arguments passed to the parent<br /> -- with a list of arguments, returning a specified result if an argument is<br /> -- not on the list<br /> local p = {}<br /> <br /> local function trim(s)<br /> return s:match(&#039;^%s*(.-)%s*$&#039;)<br /> end<br /> <br /> local function isnotempty(s)<br /> return s and s:match(&#039;%S&#039;)<br /> end<br /> <br /> local function clean(text)<br /> -- Return text cleaned for display and truncated if too long.<br /> -- Strip markers are replaced with dummy text representing the original wikitext.<br /> local pos, truncated<br /> local function truncate(text)<br /> if truncated then<br /> return &#039;&#039;<br /> end<br /> if mw.ustring.len(text) &gt; 25 then<br /> truncated = true<br /> text = mw.ustring.sub(text, 1, 25) .. &#039;...&#039;<br /> end<br /> return mw.text.nowiki(text)<br /> end<br /> local parts = {}<br /> for before, tag, remainder in text:gmatch(&#039;([^\127]*)\127[^\127]*%-(%l+)%-[^\127]*\127()&#039;) do<br /> pos = remainder<br /> table.insert(parts, truncate(before) .. &#039;&amp;lt;&#039; .. tag .. &#039;&amp;gt;...&amp;lt;/&#039; .. tag .. &#039;&amp;gt;&#039;)<br /> end<br /> table.insert(parts, truncate(text:sub(pos or 1)))<br /> return table.concat(parts)<br /> end<br /> <br /> function p._check(args, pargs)<br /> if type(args) ~= &quot;table&quot; or type(pargs) ~= &quot;table&quot; then<br /> -- TODO: error handling<br /> return<br /> end<br /> <br /> -- create the list of known args, regular expressions, and the return string<br /> local knownargs = {}<br /> local regexps = {}<br /> for k, v in pairs(args) do<br /> if type(k) == &#039;number&#039; then<br /> v = trim(v)<br /> knownargs[v] = 1<br /> elseif k:find(&#039;^regexp[1-9][0-9]*$&#039;) then<br /> table.insert(regexps, &#039;^&#039; .. v .. &#039;$&#039;)<br /> end<br /> end<br /> <br /> -- loop over the parent args, and make sure they are on the list<br /> local ignoreblank = isnotempty(args[&#039;ignoreblank&#039;])<br /> local showblankpos = isnotempty(args[&#039;showblankpositional&#039;])<br /> local values = {}<br /> for k, v in pairs(pargs) do<br /> if type(k) == &#039;string&#039; and knownargs[k] == nil then<br /> local knownflag = false<br /> for _, regexp in ipairs(regexps) do<br /> if mw.ustring.match(k, regexp) then<br /> knownflag = true<br /> break<br /> end<br /> end<br /> if not knownflag and ( not ignoreblank or isnotempty(v) ) then<br /> table.insert(values, clean(k))<br /> end<br /> elseif type(k) == &#039;number&#039; and knownargs[tostring(k)] == nil then<br /> local knownflag = false<br /> for _, regexp in ipairs(regexps) do<br /> if mw.ustring.match(tostring(k), regexp) then<br /> knownflag = true<br /> break<br /> end<br /> end<br /> if not knownflag and ( showblankpos or isnotempty(v) ) then<br /> table.insert(values, k .. &#039; = &#039; .. clean(v))<br /> end<br /> end<br /> end<br /> <br /> -- add results to the output tables<br /> local res = {}<br /> if #values &gt; 0 then<br /> local unknown_text = args[&#039;unknown&#039;] or &#039;Found _VALUE_, &#039;<br /> <br /> if mw.getCurrentFrame():preprocess( &quot;{{REVISIONID}}&quot; ) == &quot;&quot; then<br /> local preview_text = args[&#039;preview&#039;]<br /> if isnotempty(preview_text) then<br /> preview_text = require(&#039;Module:If preview&#039;)._warning({preview_text})<br /> elseif preview == nil then<br /> preview_text = unknown_text<br /> end<br /> unknown_text = preview_text<br /> end<br /> for _, v in pairs(values) do<br /> -- Fix odd bug for | = which gets stripped to the empty string and<br /> -- breaks category links<br /> if v == &#039;&#039; then v = &#039; &#039; end<br /> <br /> -- avoid error with v = &#039;example%2&#039; (&quot;invalid capture index&quot;)<br /> local r = unknown_text:gsub(&#039;_VALUE_&#039;, {_VALUE_ = v})<br /> table.insert(res, r)<br /> end<br /> end<br /> <br /> return table.concat(res)<br /> end<br /> <br /> function p.check(frame)<br /> local args = frame.args<br /> local pargs = frame:getParent().args<br /> return p._check(args, pargs)<br /> end<br /> <br /> return p</div> infobox>BusterD