Module:Sandbox/Alexiscoutinho: Difference between revisions

Content deleted Content added
No edit summary
Tag: Reverted
m Uzume moved page Module:User:Alexiscoutinho/sandbox to Module:Sandbox/Alexiscoutinho without leaving a redirect: proper Scribunto Module user sandbox space
 
(18 intermediate revisions by one other user not shown)
Line 1:
local p = {}
 
function p.test(frame)
local lang = mw.getContentLanguage()
local frame = mw.getCurrentFrame()
 
local barBoxfrozenset, set = unpack(require('Module:BarLua boxset'))
local fs = frozenset{1 ,3, 't', pairs}
local s = set{fs}
s.add(true)
s.add(false)
s.add(fs)
 
--[[local conc = ''
for k in pairs(t) do
conc = conc .. k
end]]
 
return tostring(fs) .. ' ' .. tostring(s)
end
 
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local BarBox
local barBox = require('Module:Bar box')
 
local language = 'en' -- local default language
Line 10 ⟶ 31:
return (v or '') ~= ''
end
 
local p = {}
 
function p._barColors(n)
Line 30 ⟶ 49:
 
function p._customBarStacked(args)
local barargs = {}
barargs[1] = args[1]
 
Line 51 ⟶ 70:
end
 
local width1 = 3.5
local width2 = 3.5
local width3, width4
if is(args.numwidth) then
width1 = _numwidth(mw.ustring.sub(args.numwidth,1,1))
Line 84 ⟶ 104:
barargs.collapsed = args.collapsed
barargs.id = args.id
barargs.rowstyle = is(tonumber(args.rowheight)) and ('line-height:'..args.rowheight..';') or nil
 
return barBoxBarBox._stackedstacked(barargs)
end
 
Line 134 ⟶ 153:
elseif yesno(args['firstright' .. firstright]) == false or not is(args['firstright' .. firstright]) then
if not is(args[1]) and is(args[valuecol]) then
change = '(' .. i18n['='] .. ')'
else
change = is(args[changecol]) and '(' .. args[changecol] .. ')' or ''
Line 150 ⟶ 169:
barargs.divisor = args.divisor or 1
barargs.numwidth = args.numwidth
barargs.rowheight = args.rowheight
 
if yesno(args.collapsible) == true then
Line 157 ⟶ 175:
barargs.collapsed = args.collapsed
elseif args.rowsToEnd >= duration then
barargs.collapsed = 'y'true
else
barargs.collapsed = ''false
end
 
Line 173 ⟶ 191:
end
else
barargs.collapsed = ''false
barargs.id = ''
end
 
Line 296 ⟶ 313:
rows[i].collapsible = args.collapsible
rows[i].rowsToEnd = #rows - i
rows[i].rowheight = args.rowheight
rows[i].duration = args.duration
if #months>(args.duration or 0) then
Line 305 ⟶ 321:
end
return table.concat(bars, '\n'), months
end
 
Line 437 ⟶ 453:
barargs.barwidth = 'auto'
end
barargs.rowheightlineheight = args.rowheight
 
barargs.float = args.float and args.float or 'right'
Line 475 ⟶ 492:
buildargs.changetype1 = mw.ustring.sub(args.changetype1 or (args.changetype or ''),1,1) -- 1st letter
buildargs.changetype2 = mw.ustring.sub(args.changetype2 or (args.changetype or ''),1,1) -- 1st letter
buildargs.rowheight = args.rowheight
buildargs.duration = duration
if is(args.togglesbar) then
Line 483 ⟶ 499:
end
local monthList
barargs.bars, monthList = p._buildBars(buildargs)
Line 572 ⟶ 589:
end
 
barargs.captionfooter = args.caption
barargs.css = 'TemplateModule:Medical_cases_chart/styles.css'
returnlocal barBoxbox = BarBox._boxcreate(barargs)
return tostring(box)
end
 
function p.chart(frame)
BarBox = unpack(require('Module:Bar box'))
local args = getArgs(frame, {
valueFunc = function (key, value)