Module:Navbox: Difference between revisions
various fixes from sandbox
m>Jackmcbarn (don't require the wrapper template) |
m>Jackmcbarn (various fixes from sandbox) |
||
Line 7: | Line 7: | ||
local HtmlBuilder = require('Module:HtmlBuilder') | local HtmlBuilder = require('Module:HtmlBuilder') | ||
local navbar = require('Module:Navbar')._navbar | 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 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 |