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&action=edit&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&action=edit&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&action=edit&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">⚫</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">⚫</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&diff=890288205&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 'local lang = mw.language.getContentLanguage() -- constants -------------------------------------------------------------------------------- -- Nts class -------...'</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 = 'formatted'<br />
end<br />
if not Nts.formats[self.format] then<br />
error(string.format(<br />
"'%s' is not a valid format",<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.&nbsp;}} → approx. 123,456,789.00123<br />
self.prefix = args.prefix or ''<br />
<br />
return self<br />
end<br />
<br />
<br />
-- Parse the entered number<br />
function Nts:parseNumber(s)<br />
s = s or '';<br />
s = mw.ustring.gsub(s,'&minus;','-')<br />
s = mw.ustring.gsub(s, '−', '-')<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 />
"'%s' is not a valid number",<br />
tostring(s)<br />
), 0)<br />
end<br />
end<br />
<br />
function Nts:makeDisplay()<br />
if self.format == 'hide' then<br />
return ''<br />
end<br />
if self.format == 'formatted' 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 '5000000000000000000'<br />
elseif self.number == tonumber('inf') then<br />
return '9000000000000000000'<br />
elseif self.number == tonumber('-inf') then<br />
return '1000000000000000000'<br />
else <br />
return ''<br />
end<br />
end<br />
<br />
function Nts:renderTrackingCategories()<br />
if self.hasDeprecatedParameters then<br />
return '[[Category:Nts templates with deprecated parameters]]'<br />
else<br />
return ''<br />
end<br />
end<br />
<br />
function Nts:__tostring()<br />
local root = mw.html.create()<br />
local span = root:tag('span')<br />
:attr('data-sort-value', self:makeSortKey())<br />
<br />
-- Display<br />
if self.format ~= 'hide' then<br />
span:wikitext(self:makeDisplay())<br />
else<br />
-- tidy removes empty spans. Keep nbsp content till remexhtml is deployed<br />
span:css('display', 'none')<br />
:wikitext('&nbsp;')<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 />
'<strong class="error">Error in [[Template:Nts]]: %s</strong>',<br />
ret<br />
)<br />
if mw.title.getCurrentTitle().namespace == 0 then<br />
-- Only categorise in the main namespace<br />
ret = ret .. '[[Category:Nts templates with errors]]'<br />
end<br />
return ret<br />
end<br />
end<br />
<br />
function p.main(frame)<br />
local args = require('Module:Arguments').getArgs(frame, {<br />
wrappers = { 'Template:Nts', 'Template:Ntsh' },<br />
})<br />
return p._main(args)<br />
end<br />
<br />
return p</div>
TheDJ