Модуль:Carousel
Материал из YastreWiki
Дополнительные действия
Для документации этого модуля может быть создана страница Модуль:Carousel/doc
local p = {}
function p.render(frame)
local parent = frame:getParent()
local args = parent.args
local root = mw.html.create('div')
:addClass('yastre-carousel-container')
local inner = root:tag('div')
:addClass('yastre-carousel')
local i = 1
local total = 0
while args do total = total + 1; i = i + 1 end
i = 1
while args do
local file = mw.text.trim(args)
local item = inner:tag('div'):addClass('carousel-item')
if i == 1 then
item:addClass('active')
elseif i == 2 then
item:addClass('next')
elseif i == total then
item:addClass('prev')
else
item:addClass('hidden')
end
item:wikitext('[]')
i = i + 1
end
return tostring(root)
end
return p