Modulo:Wikidata/sandbox: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
m default rank in getClaims |
+parametro rounding |
||
Riga 152:
return ret and (' ' .. ret) or ''
end
-- http://lua-users.org/wiki/SimpleRound
local function round(num, idp)
local mult = 10 ^ (idp or 0)
return math.floor(num * mult + 0.5) / mult
end
local function formatQuantity(value, args)
Riga 162 ⟶ 169:
showunit = args.showunit,
showunitlink = args.showunitlink,
formatnum = args.formatnum,
rounding = args.rounding
}
ret = mConvert._main(ret, unitId, args.unit, opts)
Riga 171 ⟶ 179:
ret = mw.language.getContentLanguage():formatNum(ret)
end
ret = args.rounding and round(ret, args.rounding) or ret
ret = ret .. formatUnitSymbol(unitId, args)
end
elseif args.formatnum then
ret = args.rounding and round(ret, args.rounding) or ret
ret = mw.language.getContentLanguage():formatNum(ret)
end
|