Documentation The documentation below is transcluded from Module:Percent/doc. (edit | history)
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,
}