https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3ANumber_table_sorting%2Fsandbox Module:Number table sorting/sandbox - Revision history 2025-05-30T15:17:00Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.3 https://en.wikipedia.org/w/index.php?title=Module:Number_table_sorting/sandbox&diff=901111777&oldid=prev QEDK: QEDK moved page Module:Nts/sandbox to Module:Number table sorting/sandbox without leaving a redirect: requested move; consensus at Module talk:Number table sorting 2019-06-09T19:39:48Z <p>QEDK moved page <a href="/w/index.php?title=Module:Nts/sandbox&amp;action=edit&amp;redlink=1" class="new" title="Module:Nts/sandbox (page does not exist)">Module:Nts/sandbox</a> to <a href="/wiki/Module:Number_table_sorting/sandbox" title="Module:Number table sorting/sandbox">Module:Number table sorting/sandbox</a> without leaving a redirect: <a href="/wiki/Wikipedia:Requested_moves" title="Wikipedia:Requested moves">requested move</a>; consensus at <a href="/wiki/Module_talk:Number_table_sorting" class="mw-redirect" title="Module talk:Number table sorting">Module talk:Number table sorting</a></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="en"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:39, 9 June 2019</td> </tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div> </td></tr></table> QEDK https://en.wikipedia.org/w/index.php?title=Module:Number_table_sorting/sandbox&diff=901110616&oldid=prev QEDK: QEDK moved page Module:Number table sorting/sandbox to Module:Nts/sandbox without leaving a redirect: Rv self 2019-06-09T19:30:19Z <p>QEDK moved page <a href="/wiki/Module:Number_table_sorting/sandbox" title="Module:Number table sorting/sandbox">Module:Number table sorting/sandbox</a> to <a href="/w/index.php?title=Module:Nts/sandbox&amp;action=edit&amp;redlink=1" class="new" title="Module:Nts/sandbox (page does not exist)">Module:Nts/sandbox</a> without leaving a redirect: Rv self</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="en"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:30, 9 June 2019</td> </tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div> </td></tr></table> QEDK https://en.wikipedia.org/w/index.php?title=Module:Number_table_sorting/sandbox&diff=901110261&oldid=prev QEDK: QEDK moved page Module:Nts/sandbox to Module:Number table sorting/sandbox without leaving a redirect: requested move; consensus at Module talk:Number table sorting 2019-06-09T19:27:25Z <p>QEDK moved page <a href="/w/index.php?title=Module:Nts/sandbox&amp;action=edit&amp;redlink=1" class="new" title="Module:Nts/sandbox (page does not exist)">Module:Nts/sandbox</a> to <a href="/wiki/Module:Number_table_sorting/sandbox" title="Module:Number table sorting/sandbox">Module:Number table sorting/sandbox</a> without leaving a redirect: <a href="/wiki/Wikipedia:Requested_moves" title="Wikipedia:Requested moves">requested move</a>; consensus at <a href="/wiki/Module_talk:Number_table_sorting" class="mw-redirect" title="Module talk:Number table sorting">Module talk:Number table sorting</a></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="en"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 19:27, 9 June 2019</td> </tr><tr><td colspan="2" class="diff-notice" lang="en"><div class="mw-diff-empty">(No difference)</div> </td></tr></table> QEDK https://en.wikipedia.org/w/index.php?title=Module:Number_table_sorting/sandbox&diff=890290117&oldid=prev TheDJ at 12:36, 31 March 2019 2019-03-31T12:36:05Z <p></p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:36, 31 March 2019</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 73:</td> <td colspan="2" class="diff-lineno">Line 73:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> -- allow for empty string as a value</div></td> </tr> <tr> <td class="diff-marker"><a class="mw-diff-movedpara-left" title="Paragraph was moved. Click to jump to new location." href="#movedpara_6_0_rhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_2_0_lhs"></a><del style="font-weight: bold; text-decoration: none;"> if </del>self.number =<del style="font-weight: bold; text-decoration: none;">= nil</del> <del style="font-weight: bold; text-decoration: none;">then</del></div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> self.number = NEGINF</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><br /></td> <td colspan="2" class="diff-empty diff-side-added"></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not self.number then</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not self.number then</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> error(string.format(</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">-- </ins>error(string.format(</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> "'%s' is not a valid number",</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">-- </ins> "'%s' is not a valid number",</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> tostring(s)</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">-- </ins> tostring(s)</div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> ), 0)</div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> <ins style="font-weight: bold; text-decoration: none;">-- </ins> ), 0)</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker"><a class="mw-diff-movedpara-right" title="Paragraph was moved. Click to jump to old location." href="#movedpara_2_0_lhs">&#x26AB;</a></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><a name="movedpara_6_0_rhs"></a><ins style="font-weight: bold; text-decoration: none;"> </ins>self.number = <ins style="font-weight: bold; text-decoration: none;">NEGINF</ins></div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td> </tr> </table> TheDJ https://en.wikipedia.org/w/index.php?title=Module:Number_table_sorting/sandbox&diff=890289636&oldid=prev TheDJ: deal with empty value 2019-03-31T12:32:10Z <p>deal with empty value</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 12:32, 31 March 2019</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 71:</td> <td colspan="2" class="diff-lineno">Line 71:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not self.number then</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> if not self.number then</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> self.number = tonumber(s)</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> self.number = tonumber(s)</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> if self.number == nil then</div></td> </tr> <tr> <td colspan="2" class="diff-empty diff-side-deleted"></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> self.number = NEGINF</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> </table> TheDJ https://en.wikipedia.org/w/index.php?title=Module:Number_table_sorting/sandbox&diff=890288205&oldid=prev TheDJ: sync 2019-03-31T12:19:53Z <p>sync</p> <a href="//en.wikipedia.org/w/index.php?title=Module:Number_table_sorting/sandbox&amp;diff=890288205&amp;oldid=847948327">Show changes</a> TheDJ https://en.wikipedia.org/w/index.php?title=Module:Number_table_sorting/sandbox&diff=847948327&oldid=prev TheDJ: ←Created page with 'local lang = mw.language.getContentLanguage() -- constants -------------------------------------------------------------------------------- -- Nts class -------...' 2018-06-28T21:24:32Z <p><a href="/wiki/Wikipedia:AES" class="mw-redirect" title="Wikipedia:AES">←</a>Created page with &#039;local lang = mw.language.getContentLanguage() -- constants -------------------------------------------------------------------------------- -- Nts class -------...&#039;</p> <p><b>New page</b></p><div>local lang = mw.language.getContentLanguage()<br /> -- constants<br /> <br /> --------------------------------------------------------------------------------<br /> -- Nts class<br /> --------------------------------------------------------------------------------<br /> <br /> local Nts = {}<br /> Nts.__index = Nts<br /> <br /> Nts.formats = {<br /> formatted = true,<br /> no = true,<br /> hide = true<br /> }<br /> <br /> function Nts.new(args)<br /> mw.logObject(args)<br /> local self = setmetatable({}, Nts)<br /> <br /> self:parseNumber(args[1])<br /> <br /> -- Set the format string<br /> if args.format then<br /> self.format = args.format<br /> else<br /> self.format = &#039;formatted&#039;<br /> end<br /> if not Nts.formats[self.format] then<br /> error(string.format(<br /> &quot;&#039;%s&#039; is not a valid format&quot;,<br /> tostring(self.format)<br /> ), 0)<br /> end<br /> <br /> -- To display some text before the display version of the number<br /> -- {{nts|123456789.00123|prefix=approx.&amp;nbsp;}} → approx. 123,456,789.00123<br /> self.prefix = args.prefix or &#039;&#039;<br /> <br /> return self<br /> end<br /> <br /> <br /> -- Parse the entered number<br /> function Nts:parseNumber(s)<br /> s = s or &#039;&#039;;<br /> s = mw.ustring.gsub(s,&#039;&amp;minus;&#039;,&#039;-&#039;)<br /> s = mw.ustring.gsub(s, &#039;−&#039;, &#039;-&#039;)<br /> self.number = lang:parseFormattedNumber(s)<br /> <br /> if not self.number then<br /> self.number = tonumber(s)<br /> end<br /> <br /> if not self.number then<br /> error(string.format(<br /> &quot;&#039;%s&#039; is not a valid number&quot;,<br /> tostring(s)<br /> ), 0)<br /> end<br /> end<br /> <br /> function Nts:makeDisplay()<br /> if self.format == &#039;hide&#039; then<br /> return &#039;&#039;<br /> end<br /> if self.format == &#039;formatted&#039; then<br /> return self.prefix .. lang:formatNum(self.number)<br /> end<br /> return self.prefix .. self.number<br /> end<br /> <br /> function Nts:makeSortKey()<br /> if self.number == 0 then<br /> return &#039;5000000000000000000&#039;<br /> elseif self.number == tonumber(&#039;inf&#039;) then<br /> return &#039;9000000000000000000&#039;<br /> elseif self.number == tonumber(&#039;-inf&#039;) then<br /> return &#039;1000000000000000000&#039;<br /> else <br /> return &#039;&#039;<br /> end<br /> end<br /> <br /> function Nts:renderTrackingCategories()<br /> if self.hasDeprecatedParameters then<br /> return &#039;[[Category:Nts templates with deprecated parameters]]&#039;<br /> else<br /> return &#039;&#039;<br /> end<br /> end<br /> <br /> function Nts:__tostring()<br /> local root = mw.html.create()<br /> local span = root:tag(&#039;span&#039;)<br /> :attr(&#039;data-sort-value&#039;, self:makeSortKey())<br /> <br /> -- Display<br /> if self.format ~= &#039;hide&#039; then<br /> span:wikitext(self:makeDisplay())<br /> else<br /> -- tidy removes empty spans. Keep nbsp content till remexhtml is deployed<br /> span:css(&#039;display&#039;, &#039;none&#039;)<br /> :wikitext(&#039;&amp;nbsp;&#039;)<br /> end<br /> <br /> -- Tracking categories<br /> root:wikitext(self:renderTrackingCategories())<br /> <br /> return tostring(root)<br /> end<br /> <br /> --------------------------------------------------------------------------------<br /> -- Exports<br /> --------------------------------------------------------------------------------<br /> <br /> local p = {}<br /> <br /> function p._exportClasses()<br /> return {<br /> Nts = Nts<br /> }<br /> end<br /> <br /> function p._main(args)<br /> local success, ret = pcall(function ()<br /> local nts = Nts.new(args)<br /> return tostring(nts)<br /> end)<br /> if success then<br /> return ret<br /> else<br /> ret = string.format(<br /> &#039;&lt;strong class=&quot;error&quot;&gt;Error in [[Template:Nts]]: %s&lt;/strong&gt;&#039;,<br /> ret<br /> )<br /> if mw.title.getCurrentTitle().namespace == 0 then<br /> -- Only categorise in the main namespace<br /> ret = ret .. &#039;[[Category:Nts templates with errors]]&#039;<br /> end<br /> return ret<br /> end<br /> end<br /> <br /> function p.main(frame)<br /> local args = require(&#039;Module:Arguments&#039;).getArgs(frame, {<br /> wrappers = { &#039;Template:Nts&#039;, &#039;Template:Ntsh&#039; },<br /> })<br /> return p._main(args)<br /> end<br /> <br /> return p</div> TheDJ