Modul:Goalscorers: Perbedaan antara revisi
Konten dihapus Konten ditambahkan
Tidak ada ringkasan suntingan |
perbaikan averageString dan updateString untuk bagian templat |
||
(11 revisi perantara oleh 2 pengguna tidak ditampilkan) | |||
Baris 1:
require('
local yesno = require('Module:Yesno')
Baris 90:
function p.addIntroductorySentence() -- menambahkan teks/paragraf awal
local totalGoalString = "Sebanyak" .. g.totalGoals .. "
local matches, dateUpdated = p.getNumberMatches()
Baris 97:
local Date = require('Module:Date')._Date
local text1 = ""
local text = string.format("Sebanyak %s gol telah dicetak", mw.getLanguage('id'):formatNum(g.totalGoals))▼
if g.totalGoals >= 1 then
if dateUpdated ~= 'complete' or dateUpdated ~= 'completed' or dateUpdated ~= 'selesai' then text1 = "telah dicetak" end
else
if dateUpdated == 'complete' or dateUpdated == 'completed' or dateUpdated == 'selesai' then text1 = "dicetak" end
end
▲ local text = string.format("Sebanyak %s gol
if matches then
Baris 103 ⟶ 110:
local precision = 3 -- presisi dua angka dibelakang koma
if average < 1 then precision = 2 end -- presisi satu angka dibelakang koma
average = string.format("%."..precision.."g", average)
end
if dateUpdated == 'complete' or dateUpdated =='completed' or dateUpdated =='selesai' or dateUpdated == "" then
text = text .. "."
else
Baris 148 ⟶ 154:
--local round = g.args['round'] or "all" -- round = all(empty)|group|playoffs
--local group = g.args['group'] or "all" -- group = all(empty), A,B,C etc
local round, group = p.getRoundAndGroup()
local allGroupGames = 0
Baris 160 ⟶ 167:
end
if group and (round == "all" and group ~= "all") then -- for totals of all rounds with only one group
if round == "all" then -- all rounds and goals
matches=0
Baris 730 ⟶ 736:
end
end -- reached end of list of goalscorers
-- if all scorers on one goal, tableString isn't updated in loop above (may need to generalise for other goal number)
local rowSpan = rankCount + 1
tableString = tableString .. '\n|-\n| style="text-align:center;" rowspan="' .. rowSpan .. '"|' .. rank
tableString = tableString .. firstplayerCell
tableString = tableString .. '\n| style="text-align:center;" rowspan="' .. rowSpan .. '"|' .. goalNumber
tableString = tableString .. playerCells
end
if tableString ~= "" then
Baris 735 ⟶ 750:
return tableString
else
return ("
end
Baris 808 ⟶ 823:
return outputString
else
return ("
end
end
Baris 847 ⟶ 862:
end
if g.args['bold'] and g.args['bold']~='no' then
text = text .. " Pemain
end
if g.args['further'] then
Baris 885 ⟶ 900:
{{#ifexpr:{{{matches}}}=1|pertandingan|pertandingan}}, dengan rata-rata
{{formatnum: {{#expr:{{{goals}}}/{{{matches}}} round 2}}}} {{formatnum:{{#ifexpr:({{{goals}}}/{{{matches}}} round 2)=1|gol|gol}}}} per pertandingan.}}
{{#if:{{{bold|}}}|{{#if:{{{assists|}}}|| }}Pemain
{{#if:{{{further|}}}|{{#if:{{{assists|}}}|| }}{{{further}}}|}}
{{#if:{{{extra|}}}|{{{extra}}}{{clear}}|}}
--]]
local statNumber =
local matches = g.args['matches']
local statType = "gol"
if g.args['assists'] or g.args['umpan gol'] then statType = "umpan gol" end
if g.args['clean sheets'] or g.args['nirbobol'] then statType = "nirbobol" end
local ongoing = g.args['ongoing']
local text1 = "Sebanyak"
if g.args['lc'] then text1 = "
local text2 = ""
if ongoing then text2 = "telah" end
local updateString = ""
local averageString = ""
-- auto version: string.format(" pada %d pertandingan, dengan rata-rata %.3g gol per pertandingan")
if g.args['goals'] and g.args['matches'] then
local averageGoals = g.args['goals']/g.args['matches']
averageString = string.format("
end
if g.args['updated'] and g.args['updated'] ~= "complete" and g.args['updated'] ~= "completed" and g.args['updated'] ~= "selesai" then
updateString = " (per " ..g.args['updated'].. ")"
end
local
if g.args['sep'] then sep = g.args['sep'] end
local text = ""
if g.args['goals'] then --Sebanyak %statNumber %statType telah dicetak pada %matches pertandingan, dengan rata-rata %averageString per pertandingan (%updateString)
▲ if g.args['goals'] then
text = string.format("%s %
text1, text2, statNumber, statType,
end
text = p.addAdditionHeaderText(text) -- handles template parameters bold, further, extra
Baris 946 ⟶ 965:
if statType == "gol" or statType == "gol bunuh diri" then
if g.args['goals'] and totalGoals ~= tonumber(g.args['goals']) then
mw.addWarning("PERINGATAN.
end
end
|