Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Zakładki/opis
local getArgs = require('Dev:Arguments').getArgs
local Tabs = {}
function Tabs.main(frame)
local args = getArgs(frame)
return Tabs._main(args)
end
function Tabs._main(args)
assert((args['tab1'] and not args[1]) or (not args['tab1'] and args[1]), 'Nie podano argumentów.')
local title = mw.title.getCurrentTitle()
local currentTab = 1
local getTab = nil
if args['tab1'] then
getTab = function(i)
return 'tab'..i
end
else
getTab = function(i)
return i
end
end
local wrapper = mw.html.create('div'):addClass('zakladki context-link')
:tag('div'):addClass('zakladki-mobilne'):wikitext('Zobacz także:'):done()
local list = mw.html.create('ul')
while args[getTab(currentTab)] do
if currentTab == 1 then
list:tag('li'):wikitext('[['..title.nsText..':'..title.baseText..'|'..args[getTab(currentTab)]..']]')
else
list:tag('li'):wikitext('[['..title.nsText..':'..title.baseText..'/'..args[getTab(currentTab)]..'|'..args[getTab(currentTab)]..']]')
end
currentTab = currentTab + 1
end
wrapper:node(list)
return wrapper
end
return Tabs
Treści społeczności są dostępne na podstawie licencji CC-BY-SA, o ile nie zaznaczono inaczej.