Content deleted Content added
clean |
gentle cleaning |
||
Line 12:
end
local function
-- These suck for i18n because the % is forced to the right without spacing,
-- both in a required context (CSS) and unrequired (to-be-displayed text).
-- I.e., there should be a separate version of this
return tostring(round(100 * param / total)) .. '%'
end
Line 23 ⟶ 22:
local remaining = total - sum
if remaining > 0 then
return
else
return nil
Line 44 ⟶ 43:
return default
end
end▼
function p.main(frame)▼
return p._main(require('Module:Arguments').getArgs(frame))▼
end
Line 84 ⟶ 79:
else
for i, class in ipairs(classes) do
-- 'or class.count' to keep us safe from
class.count = tonumber(args[i]) or class.count
sum_classes = sum_classes + class.count
Line 105 ⟶ 100:
root:addClass('progression-rainbow')
local current_frame = mw.getCurrentFrame()
for _, class in ipairs(classes) do
if class.count ~= 0 then
local percentage =
root:newline() -- sprinkled through to make the HTML easier to read
root:tag('li')
:css('background', current_frame:expandTemplate{
title = 'class/colour', args = { class.class }
})
:css('width', percentage)
:tag('span')
:addClass('sr-only')
:wikitext(string.format('%s %s', percentage, class.category))
:done()
:done()
end
end
Line 129 ⟶ 122:
if remaining then
root:tag('li')
:addClass('remaining')
:css('width', remaining)
:tag('span')
:addClass('sr-only')
:wikitext(string.format('%s remaining', remaining))
:done()
:done()
:newline()
end
Line 144 ⟶ 137:
name = 'templatestyles', args = { src = 'Screen reader-only/styles.css'}
} .. '\n' .. tostring(root)
▲end
▲function p.main(frame)
▲ return p._main(require('Module:Arguments').getArgs(frame))
end
|