Module:Page tabs
Appearance
| This Lua module is used on approximately 3,900 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 rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing. |
| This module is currently under extended confirmed protection. Extended confirmed protection prevents edits from all unregistered editors and registered users with fewer than 30 days tenure and 500 edits. The policy on community use specifies that extended confirmed protection can be applied to combat disruption, if semi-protection has proven to be ineffective. Extended confirmed protection may also be applied to enforce arbitration sanctions. Please discuss any changes on the talk page; you may submit an edit request to ask for uncontroversial changes supported by consensus. |
| 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 htmlBuilder = require('Module:HtmlBuilder')
local yesno = require('Module:Yesno')
local p = {}
function p.main(frame)
local args = getArgs(frame)
return p._main(args)
end
function p._main(args)
if not args[1] then
return '<strong class="error">Error: no arguments provided</strong>'
end
local root = htmlBuilder.create()
root.wikitext(yesno(args.NOTOC) and '__NOTOC__')
local troot = root.tag('table')
troot
.css('background', args.Background or '#f8fcff')
.css('text-align', 'center')
.css('width', '100%')
.css('border', '0')
.css('border-spacing', '0')
.css('border-collapse', 'collapse')
.css('valign', 'top')
local trow = troot.tag('tr')
for i, v in ipairs(args) do
if tonumber(args.This) == i then
trow.wikitext(p.makeThisPageTab(args[i]))
else
trow.wikitext(p.makeOtherPageTab())
end
end
trow.tag('td')
.css('border-bottom', '2px solid #a3b1bf')
.css('width', '3000px')
.wikitext(' ')
return tostring(root)
end
function p.makeThisPageTab(link)
local root = htmlBuilder.create()
root.tag('td')
.css('padding', '0.5em')
.css('background-color', 'white')
.css('line-height', '0.95em')
.css('border', 'solid 2px #a3b1bf')
.css('border-bottom', '0')
.css('font-weight', 'bold')
.css('white-space', 'nowrap')
.css('width', '20px')
.wikitext(link or 'Tab 1')
.done()
.tag('td')
.css('border-bottom', '2px solid #a3b1bf')
.css('width', '3px')
.wikitext(' ')
return tostring(root)
end
function p.makeOtherPageTab()
end
return p