Jump to content

Module:Track gauge/autodocument and Module:Track gauge/autodocument/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
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') -- /andbox here
local modTrackGauge = require('Module:Track gauge') -- sandbox here
local dataPageName = 'Module:Track gauge/data' -- /sandbox here
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>' --(20190920: linter closing span added)
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(
'%s<span class="frac" role="math">%s<span class="num">%s</span>&frasl;<span class="den">%s</span></span>',
'<span class="frac">%s%s<sup>%s</sup>&frasl;<sub>%s</sub></span>',
whole or '', whole and '<span class="visualhide">&nbsp;</span>' or '', num, den
templatestyles,
)
whole and (whole .. '<span class="sr-only">+</span>') or '',
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! &nbsp; || || || || || || || '
.. '\n! &nbsp; || || || || || || || || ||'
end
end
Line 610: Line 605:
table.insert(retHdr, '! style="background:' .. docBgHeader .. ';" | Class<br>&nbsp;')
table.insert(retHdr, '! style="background:' .. docBgHeader .. ';" | Class<br>&nbsp;')
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 .. '&nbsp;P' .. '</span>' --(20190920: linter closing span added)
catCount = sortCount .. catCount .. '&nbsp;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 .. '&nbsp;' .. catMentions)

return '\n|- style="background:' .. docBgColor .. '; border-top:2px solid #aaa;" |'
return '\n|- style="background:' .. docBgColor .. '; border-top:2px solid #aaa;" |'
.. '\n|'
.. '\n|'