Mòideal:Navboxes
Coltas
(deasbaireachd⧼tpt-languages-separator⧽ ⧼tpt-languages-separator⧽eachdraidh⧼tpt-languages-separator⧽ceanglaichean⧼tpt-languages-separator⧽doc⧼tpt-languages-separator⧽bogsa-gainmhich⧼tpt-languages-separator⧽cùisean deuchainn)
This module is currently protected from editing. See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected. |
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. |
Implements most of {{Navboxes}}
-- This implements Teamplaid:navboxes
local p = {}
local Navbox = require('Mòideal:Navbox')
local function isnotempty(s)
return s and s:match( '^%s*(.-)%s*$' ) ~= ''
end
local function navboxes(args, list)
local navbar = (args['state'] and args['state'] == 'off') and 'off' or 'plain'
local title = args['title'] or 'Links to related articles'
local titlestyle = 'background:' .. (args['bg'] or '#e8e8ff') .. ';'
.. (isnotempty(args['fg']) and ('color:' .. args['fg'] .. ';') or '')
.. (isnotempty(args['bordercolor']) and ('border: 1px solid ' .. args['bordercolor'] .. ';') or '')
.. (args['titlestyle'] or '')
return Navbox._navbox({
navbar = navbar, title = title,
list1 = list,
state = args['state'] or 'collapsed',
titlestyle = titlestyle,
liststyle = 'font-size:114%',
listpadding = '0px',
tracking = 'no'
})
end
function p.top(frame)
local args = frame:getParent().args
local parts = mw.text.split(navboxes(args, '<ADD LIST HERE>'), '<ADD LIST HERE>')
return parts[1]
end
function p.bottom(frame)
local args = {}
local parts = mw.text.split(navboxes(args, '<ADD LIST HERE>'), '<ADD LIST HERE>')
return parts[2]
end
function p.navbox(frame)
local args = frame:getParent().args
local list = args['list1'] or args['list'] or ''
local track_cats = ''
if list == '' then
if mw.title.getCurrentTitle().namespace == 0 then
track_cats = '[[Roinn-seòrsa:Navboxes template with no content]]'
end
end
return navboxes(args, list) .. track_cats
end
return p