Jump to content

Module:Sandbox/SiBr4

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SiBr4 (talk | contribs) at 12:54, 13 February 2016. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {}

-------------------------

function p.test(frame)

return ""

end

-------------------------

function p.ec(frame)

local p = frame:preprocess("{{Wikipedia:List of Wikipedians by number of edits/5001โ€“6000}}")
local i = string.find(p,"User:SiBr4")
if i then
  return string.sub(p,i-10,i-6)
else
  return "?"
end

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
local fact = rsize/math.sqrt(fsize.width*fsize.height)
local nsize = {width=round(fsize.width*fact),height=round(fsize.height*fact)}

return "[[File:"..file.."|border|"..tostring(nsize.width).."x"..tostring(nsize.height).."px]]"

end

-------------------------

return p