Changes

Module:Documentation

1,099 bytes removed, 21:44, 15 January 2014
get rid of the env:grab function
local envFunc = envFuncs[key]
if envFunc then
local success, val = pcall(envFunc() if success then env[key] = val-- Memoise the value. return val else return nilend
end
return nil
end
})
local title = env.title
local subpage = title.subpageText
local ret
if subpage == message('sandboxSubpage', 'string') or subpage == message('testcasesSubpage', 'string') then
ret = return title.basePageTitle
else
ret = return title
end
if not ret then
error(message('titleArgError', 'string', {titleArg}))
end
return ret
end
function envFuncs.sandboxTitle()
-- Title object for the /sandbox subpage.
local titleArg = return mw.title.new(env.docpageRoot .. '/' .. message('sandboxSubpage', 'string') local title = mw.title.new(titleArg) if not title then error(message('titleArgError', 'string', {titleArg})) end return title
end
function envFuncs.testcasesTitle()
-- Title object for the /testcases subpage.
local titleArg = return mw.title.new(env.docpageRoot .. '/' .. message('testcasesSubpage', 'string') local title = mw.title.new(titleArg) if not title then error(message('titleArgError', 'string', {titleArg})) end return title
end
function envFuncs.printTitle()
-- Title object for the /Print subpage.
local titleArg = return mw.title.new(env.templatePage .. '/' .. message('printSubpage', 'string') local title = mw.title.new(titleArg) if not title then error(message('titleArgError', 'string', {titleArg})) end return title end function env:grab(key) local success, val = pcall(function() return self[key] end) return success, val
end
local data = {}
-- Get title objects.
local titleSuccess, title = env:grab('title') if titleSuccess then data.title = title else return err(title) end local docTitleSuccess, docTitle = env:grab('.docTitle') if docTitleSuccess not title or not docTitle then data.docTitle = docTitle else return err(docTitle)nil
end
-- View, display, edit, and purge links if /doc exists.
function p.makeStartBoxData(args, env, links)
local subjectSpace = env.subjectSpace
if not subjectSpace then
return nil
end
local data = {}
function p._content(args, env)
-- Get the /doc title object
local success, docTitle = env:grab('.docTitle') if not success docTitle then return err(docTitle) -- docTitle is an error messagenil
end
-- Get the documentation content.
-- Get environment data.
local subjectSpace = env.subjectSpace
local success, docTitle = env:grab('.docTitle') if not success subjectSpace or not docTitle then return err(docTitle) -- Error messagenil
end
function p.makePrintBlurb(args, env)
-- Get the /Print title object
local success, printTitle = env:grab('.printTitle') if not success printTitle then return err(printTitle) -- Error messagenil
end
-- Make the print blurb.
function p.makeSubpagesBlurb(args, env)
-- Get the template title object
local success, templateTitle = env:grab('.templateTitle') if not success templateTitle then return err(templateTitle) -- Error message.nil
end
-- Make the subpages blurb.
function p.makeCategoriesBlurb(args, env)
-- Get the title object.
local success, docTitle = env:grab('.docTitle') if not success docTitle then return err(docTitle) -- Error messagenil
end
-- Make the blurb.
function p.makeDocPageBlurb(args, env)
-- Get the title object.
local success, docTitle = env:grab('.docTitle') if not success docTitle then return err(docTitle) -- Error messagenil
end
-- Make the blurb.
local templatePage = env.templatePage
-- Get title objects.
local templateSuccess, templateTitle = env:grab('.templateTitle') if not templateSuccess then return err(templateTitle) end local sandboxSuccess, sandboxTitle = env:grab('sandboxTitle') if not sandboxSuccess then return err(.sandboxTitle) end local testcasesSuccess, testcasesTitle = env:grab('.testcasesTitle') if not testcasesSuccess templateTitle or not sandboxTitle or not testcasesTitle then return err(testcasesTitle)nil
end
-- Make links.
Anonymous user