Difference between revisions of "Module:Navboxes"
Jump to navigation
Jump to search
test>Frietjes (add namespace detection to tracking, only invoked if the list is empty, so shouldn't happen very often) |
test>Frietjes (typo) |
||
| Line 19: | Line 19: | ||
local track_cats = '' | local track_cats = '' | ||
if list == '' then | if list == '' then | ||
| − | if mw.title.getCurrentTitle().namespace | + | if mw.title.getCurrentTitle().namespace == 0 then |
track_cats = '[[Category:Navboxes template with no content]]' | track_cats = '[[Category:Navboxes template with no content]]' | ||
end | end | ||
Revision as of 20:20, 8 December 2016
Implements most of {{Navboxes}}
-- This implements Template:navboxes
local p = {}
local Navbox = require('Module:Navbox')
local function isnotempty(s)
return s and s:match( '^%s*(.-)%s*$' ) ~= ''
end
function p.navbox(frame)
local args = frame:getParent().args
local navbar = (args['state'] and args['state'] == 'off') and 'off' or 'plain'
local title = args['title'] or 'Links to related articles'
local list = args['list1'] or args['list'] or ''
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 '')
local track_cats = ''
if list == '' then
if mw.title.getCurrentTitle().namespace == 0 then
track_cats = '[[Category:Navboxes template with no content]]'
end
end
return Navbox._navbox({
navbar = navbar, title = title,
list1 = list,
state = args['state'] or 'collapsed',
titlestyle = titlestyle,
liststyle = 'font-size:114%',
listpadding = '0px',
tracking = 'no'
}) .. track_cats
end
return p