![]() | This is the module sandbox page for Module:Page tabs ( diff). |
![]() | This Lua module is used on approximately 3,700 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
![]() | This module depends on the following other modules: |
This module implements {{ page tabs}}. Please see the template page for documentation.
-- This module implements {{Page tabs}}.
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local p = {}
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._main(args)
local makeTab = p.makeTab
local root = mw.html.create()
root:wikitext(yesno(args.NOTOC) and '__NOTOC__' or nil)
local row = root:tag('div')
:css('background', args.Background or nil)
:addClass('template-page-tabs')
if not args1 then
args1 = '{{{1}}}'
end
for i, link in ipairs(args) do
makeTab(row, link, tonumber(args.This) == i,
(tonumber(args.This) == i and args'tab-bg']) or args'tab1-bg'])
end
return tostring(root)
end
function p.makeTab(root, link, selected, tabColor)
root:tag('span')
:addClass('template-page-tabs-tab')
:addClass(selected and 'template-page-tabs-tab--selected' or nil)
:css('background-color', tabColor)
:wikitext(link)
end
return p
![]() | This is the module sandbox page for Module:Page tabs ( diff). |
![]() | This Lua module is used on approximately 3,700 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
![]() | This module depends on the following other modules: |
This module implements {{ page tabs}}. Please see the template page for documentation.
-- This module implements {{Page tabs}}.
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local p = {}
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._main(args)
local makeTab = p.makeTab
local root = mw.html.create()
root:wikitext(yesno(args.NOTOC) and '__NOTOC__' or nil)
local row = root:tag('div')
:css('background', args.Background or nil)
:addClass('template-page-tabs')
if not args1 then
args1 = '{{{1}}}'
end
for i, link in ipairs(args) do
makeTab(row, link, tonumber(args.This) == i,
(tonumber(args.This) == i and args'tab-bg']) or args'tab1-bg'])
end
return tostring(root)
end
function p.makeTab(root, link, selected, tabColor)
root:tag('span')
:addClass('template-page-tabs-tab')
:addClass(selected and 'template-page-tabs-tab--selected' or nil)
:css('background-color', tabColor)
:wikitext(link)
end
return p