Modul:Navbox: Unterschied zwischen den Versionen
various fixes from sandbox
(don't require the wrapper template) |
(various fixes from sandbox) |
||
Zeile 7: | Zeile 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 | ||
Zeile 282: | Zeile 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 | ||
Zeile 382: | Zeile 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 |