Content deleted Content added
tidying |
add some comments with questions I have |
||
Line 58:
}
-- generally, I think if there were more 'project' orthogonal attributes
-- there would be a case for object-orientation here
-- I'm not sure what that would look like
local project
-- is there a more idiomatic way to initialize project?
if args['project'] and args['project'] ~= '' then
project = args['project']
Line 78 ⟶ 83:
end
else
-- I'm not sure if it's clear in this for loop that I want to get
-- parameters 1 to 8, which I could also do instead as 'for 1,8...'' ]]
for i, class in pairs(classes) do
if args[i] then
Line 88 ⟶ 95:
local divisor
if project then
-- I think it makes more sense to do this sum here rather than in the
-- project loop above, because I initialized divisor here in the non-
-- project case
divisor = sum_classes + category_count(
project_classes[2]['category'],
Line 103 ⟶ 113:
if class['count'] ~= 0 then
local percentage = class_percent(class['count'], divisor)
root:newline() -- sprinkled through to make the HTML easier to read
:tag('td')
:css('background', frame:expandTemplate{
Line 110 ⟶ 120:
:css('width', percentage)
:tag('span')
-- wikitext accessibly-hidden by CSS
:wikitext(percentage .. " " .. class['category'])
-- what is the more friendly way for i18n?
:done()
:done()
Line 123 ⟶ 135:
:css('width', remaining)
:tag('span')
-- and same question here for i18n
:wikitext(remaining .. " remaining")
:done()
Line 133 ⟶ 146:
args = { src = 'Progression rainbow/styles.css'}
} .. '\n' .. tostring(root)
-- not sure how to add \n before root is initialized, because root must be
-- an HTML element, and \n is not
end
|