Changes

Jump to: navigation, search

Module:Documentation

66 bytes added, 06:20, 3 January 2014
finish converting existing values to use env table
function p._startBox(args, env)
local title = env.title
 
-- Arg processing from {{documentation}}.
local preload = args[message('preloadArg', 'string')] -- Allow custom preloads.
docpage = docname
else
local namespace = docspace or currentTitletitle.nsText local pagename = templatePage or currentTitletitle.text
docpage = namespace .. ':' .. pagename .. '/' .. message('docSubpage', 'string')
end
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, message('editLinkDisplay', 'string'))
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, message('historyLinkDisplay', 'string'))
local purgeLink = makeUrlLink(currentTitletitle:fullUrl{action = 'purge'}, message('purgeLinkDisplay', 'string'))
local text = '[%s] [%s] [%s] [%s]'
text = text:gsub('%[', '[') -- Replace square brackets with HTML entities.
p.content = makeInvokeFunc('_content')
function p._content(args, env)
local content = args[message('contentArg', 'string')]
if not content then
content = frame:preprocess('{{ ' .. docpage .. ' }}')
else
docpage = penv.docspace() .. ':' .. penv.templatePage() .. '/' .. message('docSubpage', 'string')
if mw.title.new(docpage).exists then
local frame = mw.getCurrentFrame()
p.endBox = makeInvokeFunc('_endBox')
function p._endBox(args, env) local title = env.title local subjectSpace = env.subjectSpace 
-- Argument processing in {{documentation}}.
local content = args[message('contentArg', 'string')]
local linkBox = args[message('linkBoxArg', 'string')] -- So "link box=off" works.
local docspace = penv.docspace()
local docname = args[1] -- Other docname, if fed.
local templatePage = penv.templatePage()
-- Argument processing in {{documentation/end box2}}.
local docpageRoot = (docspace or currentTitletitle.nsText) .. ':' .. (templatePage or currentTitletitle.text)
local docpage
if docname then
local sandbox = docpageRoot .. '/' .. message('sandboxSubpage', 'string')
local testcases = docpageRoot .. '/' .. message('testcasesSubpage', 'string')
templatePage = currentTitletitle.nsText .. ':' .. templatePage
-- Output from {{documentation/end box}}
----------------------------------------------------------------------------
function p.addTrackingCategories(env)
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
local title = env.title
local ret = ''
local subpage = currentTitletitle.subpageText
if message('displayStrangeUsageCategory', 'boolean') and (subpage == message('docSubpage', 'string') or subpage == message('testcasesSubpage', 'string')) then
local sort = (currentTitletitle.namespace == 0 and message('strangeUsageCategoryMainspaceSort', 'string') or '') .. currentTitletitle.prefixedText -- Sort on namespace.
ret = ret .. makeCategoryLink(message('strangeUsageCategory', 'string'), sort)
end
Anonymous user

Navigation menu