Module:Documentation: Difference between revisions

make startBox, content and endBox accessible from #invoke
(more efficient code for the subpages link)
(make startBox, content and endBox accessible from #invoke)
Line 41:
 
----------------------------------------------------------------------------
-- Argument processing
-- Main functions
----------------------------------------------------------------------------
 
local function p.mainmakeInvokeFunc(framefuncName)
localreturn argsfunction = getArgs(frame, {)
local args = getArgs(frame, {
valueFunc = function (key, value)
if type(value) == 'string' then
if type(value) == value:match('^%s*(.-)%s*$string') -- Remove whitespace.then
value = value:match('^%s*(.-)%s*$') -- Remove whitespace.
if key == 'heading' or value ~= '' then
returnif key == 'heading' or value ~= '' then
return value
else
return nil
end
else
return nilvalue
end
else
return value
end
end})
return p._main[funcName](args)
})
end
return p._main(args)
end
 
----------------------------------------------------------------------------
-- Main functions
----------------------------------------------------------------------------
 
p.main = makeInvokeFunc('_main')
 
function p._main(args)
Line 72 ⟶ 80:
.attr('id', 'template-documentation')
.addClass('template-documentation iezoomfix')
.wikitext(p.startBox_startBox(args))
.wikitext(p.content_content(args))
.tag('div')
.css('clear', 'both') -- So right or left floating items don't stick out of the doc box.
.done()
.done()
.wikitext(p.endBox_endBox(args))
.wikitext(p.addTrackingCategories())
return tostring(root)
Line 120 ⟶ 128:
end
 
function p.startBox = makeInvokeFunc(args'_startBox')
 
function p._startBox(args)
-- Arg processing from {{documentation}}.
local preload = args.preload -- Allow custom preloads.
Line 214 ⟶ 224:
end
 
function p.content = makeInvokeFunc(args'_content')
 
function p._content(args)
local content = args.content
if not content then
Line 234 ⟶ 246:
end
 
function p.endBox = makeInvokeFunc(args'_endBox')
 
function p._endBox(args)
-- Argument processing in {{documentation}}.
local preload = args.preload -- Allow custom preloads.
Anonymous user