Difference between revisions of "Module:Sandbox/SiBr4"
Jump to navigation
Jump to search
blackwiki>SiBr4 m |
m (343 revisions imported) |
||
| (7 intermediate revisions by one other user not shown) | |||
| Line 3: | Line 3: | ||
------------------------- | ------------------------- | ||
| − | function p. | + | function p.test(frame) |
| − | + | return "" | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | return | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
end | end | ||
| − | |||
| − | |||
| − | |||
------------------------- | ------------------------- | ||
| − | function p. | + | function p.ea(frame) |
| − | + | function round(n) | |
| − | + | return math.floor(n+0.5) | |
| − | |||
| − | return | ||
| − | |||
| − | |||
end | end | ||
| − | + | local args = require("Module:Arguments").getArgs(frame) | |
| + | local country = args[1] | ||
| + | local rsize = args.size and tonumber(args.size) or 18 | ||
| + | local data = require("Module:CountryData").gettable(frame,country) | ||
| + | local file = args.variant and data["flag alias-"..args.variant] or data["flag alias"] | ||
| − | + | local fsize = mw.title.new("File:"..file).file | |
| + | local fact = rsize/math.sqrt(fsize.width*fsize.height) | ||
| + | local nsize = {width=round(fsize.width*fact),height=round(fsize.height*fact)} | ||
| − | + | return "[[File:"..file..(args.border and "" or "|border").."|"..tostring(nsize.width).."x"..tostring(nsize.height).."px]]" | |
| − | |||
| − | |||
end | end | ||
Latest revision as of 11:00, 27 September 2020
local p = {}
-------------------------
function p.test(frame)
return ""
end
-------------------------
function p.ea(frame)
function round(n)
return math.floor(n+0.5)
end
local args = require("Module:Arguments").getArgs(frame)
local country = args[1]
local rsize = args.size and tonumber(args.size) or 18
local data = require("Module:CountryData").gettable(frame,country)
local file = args.variant and data["flag alias-"..args.variant] or data["flag alias"]
local fsize = mw.title.new("File:"..file).file
local fact = rsize/math.sqrt(fsize.width*fsize.height)
local nsize = {width=round(fsize.width*fact),height=round(fsize.height*fact)}
return "[[File:"..file..(args.border and "" or "|border").."|"..tostring(nsize.width).."x"..tostring(nsize.height).."px]]"
end
-------------------------
return p