Modul:Goalscorers: Perbedaan antara revisi

Konten dihapus Konten ditambahkan
kTidak ada ringkasan suntingan
perbaikan averageString dan updateString untuk bagian templat
 
(8 revisi perantara oleh 2 pengguna tidak ditampilkan)
Baris 90:
function p.addIntroductorySentence() -- menambahkan teks/paragraf awal
local totalGoalString = "Sebanyak" .. g.totalGoals .. " telah dicetak."
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 telah dicetak%s", mw.getLanguage('id'):formatNum(g.totalGoals), text1)
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)
averagetext = text .. string.format(" pada %d pertandingan, dengan rata-rata %."..precision.."gs gol per pertandingan", matches, mw.getLanguage('id'):formatNum( tonumber(average)))
text = text .. string.format(" pada %d pertandingan, %s", matches, average)
end
if dateUpdated == 'complete' or dateUpdated =='completed' or dateUpdated =='selesai' or dateUpdated == "" then
text = text .. "."
else
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)
if g.args['goals'] goalNumber == 1 then
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 889 ⟶ 904:
{{#if:{{{extra|}}}|{{{extra}}}{{clear}}|}}
--]]
local statNumber = gmw.args[getLanguage('goalsid']):formatNum( ortonumber( g.args['assistsgoals'] or 0) ) --format number as string
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 = "theresebanyak" end
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(" pada %d pertandingan, dengan rata-rata %.3g gol per pertandingan", g.args['matches'], averageGoals)
end
if g.args['updated'] and g.args['updated'] ~= "complete" and g.args['updated'] ~= "completed" and g.args['updated'] ~= "selesai" then
updateString = "&nbsp;(per " ..g.args['updated'].. ")"
end
local titiksep = "."
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 %ds %s %s dicetak pada %d pertandingan, dengan rata-rata %s gol per pertandingan"..updateString..sep,
text1, text2, statNumber, statType, averageStringg.args['matches'], mw.updateString..titikgetLanguage('id'):formatNum( tonumber(averageString)))
end
text = p.addAdditionHeaderText(text) -- handles template parameters bold, further, extra