http://proplan.55bet-pro.com/wiki/index.php?action=history&feed=atom&title=M%C3%B3dulo%3AList Módulo:List - Histórico de revisão-55BET Pro 2026-03-16T03:37:35Z 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:List&diff=77&oldid=prev Módulo:List - 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:List&diff=76&oldid=prev Módulo:List - Histórico de revisão-55BET Pro 2024-05-19T16:45:46Z <p>Per edit request</p> <p><b>Página nova</b></p><div>local libUtil = require(&#039;libraryUtil&#039;)<br /> local checkType = libUtil.checkType<br /> local mTableTools = require(&#039;Module:TableTools&#039;)<br /> <br /> local p = {}<br /> <br /> local listTypes = {<br /> [&#039;bulleted&#039;] = true,<br /> [&#039;unbulleted&#039;] = true,<br /> [&#039;horizontal&#039;] = true,<br /> [&#039;ordered&#039;] = true,<br /> [&#039;horizontal_ordered&#039;] = true<br /> }<br /> <br /> function p.makeListData(listType, args)<br /> -- Constructs a data table to be passed to p.renderList.<br /> local data = {}<br /> <br /> -- Classes and TemplateStyles<br /> data.classes = {}<br /> data.templatestyles = &#039;&#039;<br /> if listType == &#039;horizontal&#039; or listType == &#039;horizontal_ordered&#039; then<br /> table.insert(data.classes, &#039;hlist&#039;)<br /> data.templatestyles = mw.getCurrentFrame():extensionTag{<br /> name = &#039;templatestyles&#039;, args = { src = &#039;Hlist/styles.css&#039; }<br /> }<br /> elseif listType == &#039;unbulleted&#039; then<br /> table.insert(data.classes, &#039;plainlist&#039;)<br /> data.templatestyles = mw.getCurrentFrame():extensionTag{<br /> name = &#039;templatestyles&#039;, args = { src = &#039;Plainlist/styles.css&#039; }<br /> }<br /> end<br /> table.insert(data.classes, args.class)<br /> <br /> -- Main div style<br /> data.style = args.style<br /> <br /> -- Indent for horizontal lists<br /> if listType == &#039;horizontal&#039; or listType == &#039;horizontal_ordered&#039; then<br /> local indent = tonumber(args.indent)<br /> indent = indent and indent * 1.6 or 0<br /> if indent &gt; 0 then<br /> data.marginLeft = indent .. &#039;em&#039;<br /> end<br /> end<br /> <br /> -- List style types for ordered lists<br /> -- This could be &quot;1, 2, 3&quot;, &quot;a, b, c&quot;, or a number of others. The list style<br /> -- type is either set by the &quot;type&quot; attribute or the &quot;list-style-type&quot; CSS<br /> -- property.<br /> if listType == &#039;ordered&#039; or listType == &#039;horizontal_ordered&#039; then <br /> data.listStyleType = args.list_style_type or args[&#039;list-style-type&#039;]<br /> data.type = args[&#039;type&#039;]<br /> <br /> -- Detect invalid type attributes and attempt to convert them to<br /> -- list-style-type CSS properties.<br /> if data.type <br /> and not data.listStyleType<br /> and not tostring(data.type):find(&#039;^%s*[1AaIi]%s*$&#039;)<br /> then<br /> data.listStyleType = data.type<br /> data.type = nil<br /> end<br /> end<br /> <br /> -- List tag type<br /> if listType == &#039;ordered&#039; or listType == &#039;horizontal_ordered&#039; then<br /> data.listTag = &#039;ol&#039;<br /> else<br /> data.listTag = &#039;ul&#039;<br /> end<br /> <br /> -- Start number for ordered lists<br /> data.start = args.start<br /> if listType == &#039;horizontal_ordered&#039; then<br /> -- Apply fix to get start numbers working with horizontal ordered lists.<br /> local startNum = tonumber(data.start)<br /> if startNum then<br /> data.counterReset = &#039;listitem &#039; .. tostring(startNum - 1)<br /> end<br /> end<br /> <br /> -- List style<br /> -- ul_style and ol_style are included for backwards compatibility. No<br /> -- distinction is made for ordered or unordered lists.<br /> data.listStyle = args.list_style<br /> <br /> -- List items<br /> -- li_style is included for backwards compatibility. item_style was included<br /> -- to be easier to understand for non-coders.<br /> data.itemStyle = args.item_style or args.li_style<br /> data.items = {}<br /> for _, num in ipairs(mTableTools.numKeys(args)) do<br /> local item = {}<br /> item.content = args[num]<br /> item.style = args[&#039;item&#039; .. tostring(num) .. &#039;_style&#039;]<br /> or args[&#039;item_style&#039; .. tostring(num)]<br /> item.value = args[&#039;item&#039; .. tostring(num) .. &#039;_value&#039;]<br /> or args[&#039;item_value&#039; .. tostring(num)]<br /> table.insert(data.items, item)<br /> end<br /> <br /> return data<br /> end<br /> <br /> function p.renderList(data)<br /> -- Renders the list HTML.<br /> <br /> -- Return the blank string if there are no list items.<br /> if type(data.items) ~= &#039;table&#039; or #data.items &lt; 1 then<br /> return &#039;&#039;<br /> end<br /> <br /> -- Render the main div tag.<br /> local root = mw.html.create(&#039;div&#039;)<br /> for _, class in ipairs(data.classes or {}) do<br /> root:addClass(class)<br /> end<br /> root:css{[&#039;margin-left&#039;] = data.marginLeft}<br /> if data.style then<br /> root:cssText(data.style)<br /> end<br /> <br /> -- Render the list tag.<br /> local list = root:tag(data.listTag or &#039;ul&#039;)<br /> list<br /> :attr{start = data.start, type = data.type}<br /> :css{<br /> [&#039;counter-reset&#039;] = data.counterReset,<br /> [&#039;list-style-type&#039;] = data.listStyleType<br /> }<br /> if data.listStyle then<br /> list:cssText(data.listStyle)<br /> end<br /> <br /> -- Render the list items<br /> for _, t in ipairs(data.items or {}) do<br /> local item = list:tag(&#039;li&#039;)<br /> if data.itemStyle then<br /> item:cssText(data.itemStyle)<br /> end<br /> if t.style then<br /> item:cssText(t.style)<br /> end<br /> item<br /> :attr{value = t.value}<br /> :wikitext(t.content)<br /> end<br /> <br /> return data.templatestyles .. tostring(root)<br /> end<br /> <br /> function p.renderTrackingCategories(args)<br /> local isDeprecated = false -- Tracks deprecated parameters.<br /> for k, v in pairs(args) do<br /> k = tostring(k)<br /> if k:find(&#039;^item_style%d+$&#039;) or k:find(&#039;^item_value%d+$&#039;) then<br /> isDeprecated = true<br /> break<br /> end<br /> end<br /> local ret = &#039;&#039;<br /> if isDeprecated then<br /> ret = ret .. &#039;[[Category:List templates with deprecated parameters]]&#039;<br /> end<br /> return ret<br /> end<br /> <br /> function p.makeList(listType, args)<br /> if not listType or not listTypes[listType] then<br /> error(string.format(<br /> &quot;bad argument #1 to &#039;makeList&#039; (&#039;%s&#039; is not a valid list type)&quot;,<br /> tostring(listType)<br /> ), 2)<br /> end<br /> checkType(&#039;makeList&#039;, 2, args, &#039;table&#039;)<br /> local data = p.makeListData(listType, args)<br /> local list = p.renderList(data)<br /> local trackingCategories = p.renderTrackingCategories(args)<br /> return list .. trackingCategories<br /> end<br /> <br /> for listType in pairs(listTypes) do<br /> p[listType] = function (frame)<br /> local mArguments = require(&#039;Module:Arguments&#039;)<br /> local origArgs = mArguments.getArgs(frame, {<br /> frameOnly = ((frame and frame.args and frame.args.frameonly or &#039;&#039;) ~= &#039;&#039;),<br /> valueFunc = function (key, value)<br /> if not value or not mw.ustring.find(value, &#039;%S&#039;) then return nil end<br /> if mw.ustring.find(value, &#039;^%s*[%*#;:]&#039;) then<br /> return value<br /> else<br /> return value:match(&#039;^%s*(.-)%s*$&#039;)<br /> end<br /> return nil<br /> end<br /> })<br /> -- Copy all the arguments to a new table, for faster indexing.<br /> local args = {}<br /> for k, v in pairs(origArgs) do<br /> args[k] = v<br /> end<br /> return p.makeList(listType, args)<br /> end<br /> end<br /> <br /> return p</div> infobox>Pppery