Module:Track gauge/autodocument and Module:Track gauge/autodocument/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
my mistake, this URL is used only for the "purge" link, therefore the protocol-relative is fine |
my mistake, this URL is used only for the "purge" link, therefore the protocol-relative is fine |
||
Line 6: | Line 6: | ||
local getArgs = require('Module:Arguments').getArgs |
local getArgs = require('Module:Arguments').getArgs |
||
local modMath = require('Module:Math') |
local modMath = require('Module:Math') |
||
local modTrackGauge = require('Module:Track gauge') -- |
local modTrackGauge = require('Module:Track gauge') -- sandbox here |
||
local dataPageName = 'Module:Track gauge/data' -- |
local dataPageName = 'Module:Track gauge/data/sandbox' -- sandbox here |
||
local gaugeDataAll = nil |
local gaugeDataAll = nil |
||
Line 151: | Line 151: | ||
ttlSizeClassCount[j][2] = ttlSizeClassCount[j][2] +1 |
ttlSizeClassCount[j][2] = ttlSizeClassCount[j][2] +1 |
||
ttlSizeClassCount[j][4] = ttlSizeClassCount[j][4] + (countMentionings or 0) |
ttlSizeClassCount[j][4] = ttlSizeClassCount[j][4] + (countMentionings or 0) |
||
return '<span data-sort-value="' .. j .. '">' .. ttlSizeClassCount[j][1] .. '</span>' |
return '<span data-sort-value="' .. j .. '">' .. ttlSizeClassCount[j][1] .. '</span>' |
||
end |
end |
||
----------------------------------------------------------------------------------- |
----------------------------------------------------------------------------------- |
||
Line 179: | Line 179: | ||
----------------------------------------------------------------------------------- |
----------------------------------------------------------------------------------- |
||
local function frac(whole, num, den) |
local function frac(whole, num, den) |
||
local templatestyles = mw.getCurrentFrame():extensionTag{ |
|||
name = 'templatestyles', args = { src = 'Fraction/styles.css' } |
|||
} |
|||
return mw.ustring.format( |
return mw.ustring.format( |
||
' |
'<span class="frac">%s%s<sup>%s</sup>⁄<sub>%s</sub></span>', |
||
⚫ | |||
templatestyles, |
|||
⚫ | |||
⚫ | |||
num, |
|||
den |
|||
) |
|||
end |
end |
||
----------------------------------------------------------------------------------- |
----------------------------------------------------------------------------------- |
||
-- debugReturnArgs |
-- debugReturnArgs |
||
Line 543: | Line 536: | ||
table.insert(retFoot, '*Categories') |
table.insert(retFoot, '*Categories') |
||
table.insert(retFoot, ':Content categories: ' .. ttlContentCatsCount) |
table.insert(retFoot, ':Content categories: ' .. ttlContentCatsCount) |
||
table.insert(retFoot, ':"Article mentions track gauge" categories: ' .. ttlMentioningCatsCount) |
|||
table.insert(retFoot, ':Articles listed in "mentions" categories: ' .. ttlMentioningPageCount .. ' (not unique)') |
|||
-- Size classes (narrow, broad, ..) |
-- Size classes (narrow, broad, ..) |
||
table.insert(retFoot, '*Size classes') |
table.insert(retFoot, '*Size classes') |
||
Line 589: | Line 584: | ||
-- todo: 10 cols with bg color |
-- todo: 10 cols with bg color |
||
sortColHeaders = '\n|- style="background:' .. docBgHeader .. '; line-height:90%;"' |
sortColHeaders = '\n|- style="background:' .. docBgHeader .. '; line-height:90%;"' |
||
.. '\n! || || || || || || || ' |
.. '\n! || || || || || || || || ||' |
||
end |
end |
||
Line 610: | Line 605: | ||
table.insert(retHdr, '! style="background:' .. docBgHeader .. ';" | Class<br> ') |
table.insert(retHdr, '! style="background:' .. docBgHeader .. ';" | Class<br> ') |
||
table.insert(retHdr, '! style="background:' .. docBgHeader .. '; min-width:5em;" | Source<br>article') |
table.insert(retHdr, '! style="background:' .. docBgHeader .. '; min-width:5em;" | Source<br>article') |
||
table.insert(retHdr, '! style="background:' .. docBgHeader .. ';" | [[:Category:Track gauges by size|Category]]<br>(content)') |
|||
table.insert(retHdr, '! style="background:' .. docBgHeader .. ';" | ' .. catMparent .. '<br>(maintenance)') |
|||
return table.concat(retHdr, '\n') .. sortColHeaders |
return table.concat(retHdr, '\n') .. sortColHeaders |
||
Line 811: | Line 808: | ||
sortCount = mw.text.truncate('00000' .. tostring(catCount), -5, '') |
sortCount = mw.text.truncate('00000' .. tostring(catCount), -5, '') |
||
sortCount = '<span data-sort-value="' .. sortCount .. '">' |
sortCount = '<span data-sort-value="' .. sortCount .. '">' |
||
catCount = sortCount .. catCount .. ' P |
catCount = sortCount .. catCount .. ' P</span>' |
||
-- Compose the size-id row with all cell values (10 columns) |
-- Compose the size-id row with all cell values (10 columns) |
||
Line 823: | Line 820: | ||
table.insert(row, rgSizeClass) |
table.insert(row, rgSizeClass) |
||
table.insert(row, table.concat(linkArticle, rowSplit)) |
table.insert(row, table.concat(linkArticle, rowSplit)) |
||
table.insert(row, table.concat(catContent, rowSplit)) |
|||
⚫ | |||
table.insert(row, catCount .. ' ' .. catMentions) |
|||
return '\n|- style="background:' .. docBgColor .. '; border-top:2px solid #aaa;" |' |
return '\n|- style="background:' .. docBgColor .. '; border-top:2px solid #aaa;" |' |
||
.. '\n|' |
.. '\n|' |