Jump to content

Module:Goalscorers and Module:Goalscorers/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
Undid revision 1284281081 by Jts1882 (talk) revert test for now
 
adding œ --> oe
 
Line 494: Line 494:
{ "ė", "e" } , { "ľ", "l" } , { "ģ", "g" },
{ "ė", "e" } , { "ľ", "l" } , { "ģ", "g" },
{ "ļ", "l" } , { "ę", "e" } , { "ň", "n" },
{ "ļ", "l" } , { "ę", "e" } , { "ň", "n" },
{ "ò", "o" }
{ "ò", "o" } , { "œ", "oe" }
}
}
for k,v in pairs(specialChars) do -- replace special characters from supplied list
for k,v in pairs(specialChars) do -- replace special characters from supplied list
Line 708: Line 708:
else -- else generate previous rowspan
else -- else generate previous rowspan
local rowSpan = rankCount
local rowSpan = rankCount
if playerCount > maxRank * 1.5 then
if playerCount >= maxRank * 1.5 then
firstplayerCell = '\n| style="font-style:italic;text-align:center;"|' .. rankCount .. " players"
firstplayerCell = '\n| style="font-style:italic;text-align:center;"|' .. rankCount .. " players"
playerCells = ""
playerCells = ""
Line 729: Line 729:
playerCells = playerCells .. '\n|-' .. '\n|' .. goalscorerString -- add to player cell list
playerCells = playerCells .. '\n|-' .. '\n|' .. goalscorerString -- add to player cell list
end
end
end -- reached end of list of goalscorers [for j,u loop]
end -- reached end of list of goalscorers [for j,u loop]
-- if all scorers on one goal, tableString isn't updated in loop above (may need to generalise for other goal number)
-- if all scorers on one goal, tableString isn't updated in loop above (may need to generalise for other goal number)
if goalNumber == 1 and rankCount >= (10-1) then -- special case: long list of goalscorers with one goal; don't show if more than 10 players
firstplayerCell = '\n| style="font-style:italic;text-align:center;"|' .. (rankCount+1) .. " players" -- replace list with "x players" text
playerCells = "" -- clear multirow list of players on one goal
rankCount = 0 -- reset to get single rowspan in next section
end
if goalNumber == 1 and rank <= maxRank then
if goalNumber == 1 and rank <= maxRank then
local rowSpan = rankCount + 1
local rowSpan = rankCount + 1
tableString = tableString .. '\n|-\n| style="text-align:center;" rowspan="' .. rowSpan .. '"|' .. rank
tableString = tableString .. '\n|-\n| style="text-align:center;" rowspan="' .. rowSpan .. '"|' .. rank
tableString = tableString .. firstplayerCell
tableString = tableString .. firstplayerCell
tableString = tableString .. '\n| style="text-align:center;" rowspan="' .. rowSpan .. '"|' .. goalNumber
tableString = tableString .. '\n| style="text-align:center;" rowspan="' .. rowSpan .. '"|' .. goalNumber
tableString = tableString .. playerCells
tableString = tableString .. playerCells
end
end


Line 898: Line 904:
{{#if:{{{extra|}}}|{{{extra}}}{{clear}}|}}
{{#if:{{{extra|}}}|{{{extra}}}{{clear}}|}}
--]]
--]]
local statNumber = mw.getLanguage('en'):formatNum( tonumber( g.args['goals'] or 0) ) --format goal number as string
local statNumber = g.args['goals'] or g.args['assists'] or 0
local matches = g.args['matches']
local matches = g.args['matches']
local statType = "goal"
local statType = "goal"
Line 934: Line 940:
local text = ""
local text = ""
if g.args['goals'] then
if g.args['goals'] then
text = string.format("%s %s %s %s%s scored%s",
text = string.format("%s %s %d %s%s scored%s",
text1, text2, statNumber, statType, goalPlural, averageString..updateString..sep)
text1, text2, statNumber, statType, goalPlural, averageString..updateString..sep)
end
end
Line 942: Line 948:
<div class="div-col columns column-count column-count-3" style="column-count:3;">
<div class="div-col columns column-count column-count-3" style="column-count:3;">
{{#if:{{{assists|}}}|{{{30 assists}}}|{{{30 goals}}}}}</div>|}}]]
{{#if:{{{assists|}}}|{{{30 assists}}}|{{{30 goals}}}}}</div>|}}]]
local output = "\n"
local output = (text == "") and "" or "\n"
local number = 30
local number = 30
Line 992: Line 998:
local source = g.args['source'] or ""
local source = g.args['source'] or ""
if source ~= "" then source = "<small>Source: " .. source .. "</small>" end
if source ~= "" then source = "<small>Source: " .. source .. "</small>" end

return text .. output .. footer .. source
return text .. output .. footer .. source
end
end