14,091
edits
m (1 revision) |
m (1 revision) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
local HtmlBuilder = require('Module:HtmlBuilder') | local HtmlBuilder = require('Module:HtmlBuilder') | ||
local | local navbar = require('Module:Navbar')._navbar | ||
local getArgs -- lazily initialized | |||
local args | local args | ||
local tableRowAdded = false | local tableRowAdded = false | ||
local border | local border | ||
Line 50: | Line 50: | ||
-- also no show/hide link, then we need a spacer on the right to achieve the left shift. | -- also no show/hide link, then we need a spacer on the right to achieve the left shift. | ||
if args.state == 'plain' then spacerSide = 'right' end | if args.state == 'plain' then spacerSide = 'right' end | ||
elseif args.navbar == 'plain' or args. | elseif args.navbar == 'plain' or (not args.name and mw.getCurrentFrame():getParent():getTitle() == 'Template:Navbox' and (border == 'subgroup' or border == 'child' or border == 'none')) then | ||
-- No navbar. Need a spacer on the left to balance out the width of the show/hide link. | -- No navbar. Need a spacer on the left to balance out the width of the show/hide link. | ||
if args.state ~= 'plain' then spacerSide = 'left' end | if args.state ~= 'plain' then spacerSide = 'left' end | ||
Line 58: | Line 58: | ||
if args.state == 'plain' then spacerSide = 'right' end | if args.state == 'plain' then spacerSide = 'right' end | ||
titleCell.wikitext( | titleCell.wikitext(navbar{ | ||
args.name, | args.name, | ||
mini = 1, | mini = 1, | ||
fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none;' | fontstyle = (args.basestyle or '') .. ';' .. (args.titlestyle or '') .. ';background:none transparent;border:none;' | ||
} | }) | ||
end | end | ||
Line 271: | Line 271: | ||
local function hasBackgroundColors() | local function hasBackgroundColors() | ||
return args.titlestyle or args.groupstyle | return mw.ustring.match(args.titlestyle or '','background') or mw.ustring.match(args.groupstyle or '','background') or mw.ustring.match(args.basestyle or '','background') | ||
end | end | ||
Line 282: | Line 282: | ||
local function renderTrackingCategories(builder) | local function renderTrackingCategories(builder) | ||
local | local title = mw.title.getCurrentTitle() | ||
if title.namespace ~= 10 then return end -- not in template space | |||
if | local subpage = title.subpageText | ||
local subpage = | |||
if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end | if subpage == 'doc' or subpage == 'sandbox' or subpage == 'testcases' then return end | ||
Line 382: | Line 378: | ||
function p.navbox(frame) | function p.navbox(frame) | ||
if not getArgs then | |||
getArgs = require('Module:Arguments').getArgs | |||
end | |||
args = getArgs(frame, {wrappers = 'Template:Navbox'}) | |||
-- | -- Read the arguments in the order they'll be output in, to make references number in the right order. | ||
local | local _ | ||
_ = args.title | |||
_ = args.above | |||
for i = 1, 20 do | for i = 1, 20 do | ||
_ = args["group" .. tostring(i)] | |||
_ = args["list" .. tostring(i)] | |||
end | end | ||
_ = args.below | |||
return p._navbox(args) | return p._navbox(args) | ||
end | end | ||
return p | return p |