模块:Percent
跳到导航
跳到搜索
亦可参看英文模块:Module:Percent。那边可能有更完整或更正确的信息。
This module provides functionality to the {{percent}}
template.
return {
format = function(frame)
local str = frame.args[1]
local format = frame.args[2]
local dec = frame.args[3]
str = mw.ustring.gsub(str, '([.%d–-][.%s%d–-]*)%s*%%', function(s)
s = mw.text.trim(s)
s = string.gsub(s, '%.', dec)
s = string.gsub(format, '%$percentage%$', s)
return s
end)
return str
end,
}