http://proplan.55bet-pro.com/wiki/index.php?action=history&feed=atom&title=M%C3%B3dulo%3ALua_banner Módulo:Lua banner - Histórico de revisão-55BET Pro 2026-04-05T00:24:59Z 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:Lua_banner&diff=165&oldid=prev Módulo:Lua banner - Histórico de revisão-55BET Pro 2024-06-27T11:12:00Z <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 08h12min 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:Lua_banner&diff=164&oldid=prev Módulo:Lua banner - Histórico de revisão-55BET Pro 2024-04-05T02:45:24Z <p>protect against &quot;mw.title.new()&quot; returns &quot;nil&quot;</p> <p><b>Página nova</b></p><div>-- This module implements the {{lua}} template.<br /> local yesno = require(&#039;Module:Yesno&#039;)<br /> local mList = require(&#039;Module:List&#039;)<br /> local mTableTools = require(&#039;Module:TableTools&#039;)<br /> local mMessageBox = require(&#039;Module:Message box&#039;)<br /> <br /> local p = {}<br /> <br /> function p.main(frame)<br /> local origArgs = frame:getParent().args<br /> local args = {}<br /> for k, v in pairs(origArgs) do<br /> v = v:match(&#039;^%s*(.-)%s*$&#039;)<br /> if v ~= &#039;&#039; then<br /> args[k] = v<br /> end<br /> end<br /> return p._main(args)<br /> end<br /> <br /> function p._main(args)<br /> local modules = mTableTools.compressSparseArray(args)<br /> local box = p.renderBox(modules)<br /> local trackingCategories = p.renderTrackingCategories(args, modules)<br /> return box .. trackingCategories<br /> end<br /> <br /> function p.renderBox(modules)<br /> local boxArgs = {}<br /> if #modules &lt; 1 then<br /> boxArgs.text = &#039;&lt;strong class=&quot;error&quot;&gt;Error: no modules specified&lt;/strong&gt;&#039;<br /> else<br /> local moduleLinks = {}<br /> for i, module in ipairs(modules) do<br /> moduleLinks[i] = string.format(&#039;[[:%s]]&#039;, module)<br /> local maybeSandbox = mw.title.new(module .. &#039;/sandbox&#039;)<br /> if maybeSandbox and maybeSandbox.exists then<br /> moduleLinks[i] = moduleLinks[i] .. string.format(&#039; ([[:%s|sandbox]])&#039;, maybeSandbox.fullText)<br /> end<br /> end<br /> local moduleList = mList.makeList(&#039;bulleted&#039;, moduleLinks)<br /> local title = mw.title.getCurrentTitle()<br /> if title.subpageText == &quot;doc&quot; then<br /> title = title.basePageTitle<br /> end<br /> if title.contentModel == &quot;Scribunto&quot; then<br /> boxArgs.text = &#039;This module depends on the following other modules:&#039; .. moduleList<br /> else<br /> boxArgs.text = &#039;This template uses [[Wikipedia:Lua|Lua]]:\n&#039; .. moduleList<br /> end<br /> end<br /> boxArgs.type = &#039;notice&#039;<br /> boxArgs.small = true<br /> boxArgs.image = &#039;[[File:Lua-Logo.svg|30px|alt=|link=]]&#039;<br /> return mMessageBox.main(&#039;mbox&#039;, boxArgs)<br /> end<br /> <br /> function p.renderTrackingCategories(args, modules, titleObj)<br /> if yesno(args.nocat) then<br /> return &#039;&#039;<br /> end<br /> <br /> local cats = {}<br /> <br /> -- Error category<br /> if #modules &lt; 1 then<br /> cats[#cats + 1] = &#039;Lua templates with errors&#039;<br /> end<br /> <br /> -- Lua templates category<br /> titleObj = titleObj or mw.title.getCurrentTitle()<br /> local subpageBlacklist = {<br /> doc = true,<br /> sandbox = true,<br /> sandbox2 = true,<br /> testcases = true<br /> }<br /> if not subpageBlacklist[titleObj.subpageText] then<br /> local protCatName<br /> if titleObj.namespace == 10 then<br /> local category = args.category<br /> if not category then<br /> local categories = {<br /> [&#039;Module:String&#039;] = &#039;Templates based on the String Lua module&#039;,<br /> [&#039;Module:Math&#039;] = &#039;Templates based on the Math Lua module&#039;,<br /> [&#039;Module:BaseConvert&#039;] = &#039;Templates based on the BaseConvert Lua module&#039;,<br /> [&#039;Module:Citation/CS1&#039;] = &#039;Templates based on the Citation/CS1 Lua module&#039;<br /> }<br /> category = modules[1] and categories[modules[1]]<br /> category = category or &#039;Lua-based templates&#039;<br /> end <br /> cats[#cats + 1] = category<br /> protCatName = &quot;Templates using under-protected Lua modules&quot;<br /> elseif titleObj.namespace == 828 then<br /> protCatName = &quot;Modules depending on under-protected modules&quot;<br /> end<br /> if not args.noprotcat and protCatName then<br /> local protLevels = {<br /> autoconfirmed = 1,<br /> extendedconfirmed = 2,<br /> templateeditor = 3,<br /> sysop = 4<br /> }<br /> local currentProt<br /> if titleObj.id ~= 0 then<br /> -- id is 0 (page does not exist) if am previewing before creating a template.<br /> currentProt = titleObj.protectionLevels[&quot;edit&quot;][1]<br /> end<br /> if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end<br /> for i, module in ipairs(modules) do<br /> if module ~= &quot;WP:libraryUtil&quot; then<br /> local moduleTitle = mw.title.new(module)<br /> local moduleProt = moduleTitle and moduleTitle.protectionLevels[&quot;edit&quot;][1]<br /> if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end<br /> if moduleProt &lt; currentProt then<br /> cats[#cats + 1] = protCatName<br /> break<br /> end<br /> end<br /> end<br /> end<br /> end<br /> for i, cat in ipairs(cats) do<br /> cats[i] = string.format(&#039;[[Category:%s]]&#039;, cat)<br /> end<br /> return table.concat(cats)<br /> end<br /> <br /> return p</div> infobox>Uzume