Module:Page tabs
Jump to navigation
Jump to search
{{#switch:
{{#if: | | {{#ifeq:Module|Module | module | other }} }}
| module = Page Module:Message box/ombox.css has no content.
{{#switch: protected
| pre-alpha | prealpha | pa = Pre-alpha | alpha | a = Alpha | beta | b = Beta | release | r | general | g = Ready for use | protected | protect | p = [[File:{{#switch:Lua error in Module:Effective_protection_level at line 14: attempt to index local 'title' (a nil value).|autoconfirmed=Semi|extendedconfirmed=Extended|accountcreator|templateeditor=Template|#default=Full}}-protection-shackle.svg|40x40px|link=|alt=Protected]] | semiprotected | semiprotect | semi =Semi-protected}} | {{#switch: protected
| pre-alpha | prealpha | pa = This module is rated as pre-alpha. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure.{{#switch: Page tabs|doc|sandbox= | {{#ifeq: | true | | }} }} | alpha | a = This module is rated as alpha. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome.{{#switch: Page tabs|doc|sandbox= | {{#ifeq: | true | | }} }} | beta | b = This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected.{{#switch: Page tabs|doc|sandbox= | {{#ifeq: | true | | }} }} | release | r | general | g = This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing.{{#switch: Page tabs|doc|sandbox= | {{#ifeq: | true | | }} }} | protected | protect | p = 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.{{#switch: Page tabs|doc|sandbox= | {{#ifeq: | true | | }} }} | semiprotected | semiprotect | semi = 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 semi-protected from editing.{{#switch: Page tabs|doc|sandbox= | {{#ifeq: | true | | }} }} | #default = Template:Error}} |
| other | #default = Template:Error }}
Page Module:Message box/ombox.css has no content.
File:Lua-Logo.svg | 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 '#f8fcff')
:addClass('template-page-tabs')
if not args[1] then
args[1] = '{{{1}}}'
end
for i, link in ipairs(args) do
makeTab(row, link, args, i)
end
return tostring(root)
end
function p.makeTab(root, link, args, i)
local thisPage = (args.This == 'auto' and link:find('[[' .. mw.title.getCurrentTitle().prefixedText .. '|', 1, true)) or tonumber(args.This) == i
root:tag('span')
:css('background-color', thisPage and (args['tab-bg'] or 'white') or (args['tab1-bg'] or '#cee0f2'))
:cssText(thisPage and 'border-bottom:0;font-weight:bold' or 'font-size:95%')
:wikitext(link)
:done()
:wikitext('<span class="spacer"> </span>')
end
return p