Changes
Jump to navigation
Jump to search
Line 139:
Line 139:
+
+
+
Line 177:
Line 180:
− -- env.printTitle - the print version of the template, located at the /Print subpage.
Line 271:
Line 273:
− end
−
− function envFuncs.printTitle()
− --[[
− -- Title object for the /Print subpage.
− -- Messages:
− -- 'print-subpage' --> 'Print'
− --]]
− return env.templateTitle:subPageTitle(message('print-subpage'))
Line 498:
Line 491:
− -- 'file-docpage-preload' --> 'Template:Documentation/preload-filespace'
Line 524:
Line 516:
− +
− preload = message('file-docpage-preload')
− elseif subjectSpace == 828 then -- Module namespace
Line 539:
Line 529:
− +
Line 553:
Line 543:
+
− local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay)
Line 563:
Line 553:
− +
− +
Line 640:
Line 630:
+
Line 740:
Line 731:
− local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates.
− if printBlurb then
− text = text .. '<br />' .. printBlurb
− end
Line 960:
Line 947:
− end
−
− function p.makePrintBlurb(args, env)
− --[=[
− -- Generates the blurb displayed when there is a print version of the template available.
− -- @args - a table of arguments passed by the user
− -- @env - environment table containing title objects, etc., generated with p.getEnvironment
− --
− -- Messages:
− -- 'print-link-display' --> '/Print'
− -- 'print-blurb' --> 'A [[Help:Books/for experts#Improving the book layout|print version]]'
− -- .. ' of this template exists at $1.'
− -- .. ' If you make a change to this template, please update the print version as well.'
− -- 'display-print-category' --> true
− -- 'print-category' --> 'Templates with print versions'
− --]=]
− local printTitle = env.printTitle
− if not printTitle then
− return nil
− end
− local ret
− if printTitle.exists then
− local printLink = makeWikilink(printTitle.prefixedText, message('print-link-display'))
− ret = message('print-blurb', {printLink})
− local displayPrintCategory = message('display-print-category', nil, 'boolean')
− if displayPrintCategory then
− ret = ret .. makeCategoryLink(message('print-category'))
− end
− end
− return ret
sync from sandbox, add aria role and label to container
-- 'documentation-container'
-- 'documentation-container'
:addClass(message('container'))
:addClass(message('container'))
:attr('role', 'complementary')
:attr('aria-labelledby', args.heading ~= '' and 'documentation-heading' or nil)
:attr('aria-label', args.heading == '' and 'Documentation' or nil)
:newline()
:newline()
:tag('div')
:tag('div')
-- env.sandboxTitle - the /sandbox subpage.
-- env.sandboxTitle - the /sandbox subpage.
-- env.testcasesTitle - the /testcases subpage.
-- env.testcasesTitle - the /testcases subpage.
--
--
-- Data includes:
-- Data includes:
--]]
--]]
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage'))
end
end
-- 'history-link-display' --> 'history'
-- 'history-link-display' --> 'history'
-- 'purge-link-display' --> 'purge'
-- 'purge-link-display' --> 'purge'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'docpage-preload' --> 'Template:Documentation/preload'
-- 'docpage-preload' --> 'Template:Documentation/preload'
local preload = args.preload
local preload = args.preload
if not preload then
if not preload then
if subjectSpace == 6 then -- File namespace
if subjectSpace == 828 then -- Module namespace
preload = message('module-preload')
preload = message('module-preload')
else
else
function p.renderStartBoxLinks(data)
function p.renderStartBoxLinks(data)
--[[
--[[
-- Generates the [view][edit][history][purge] or [create] links from the data table.
-- Generates the [view][edit][history][purge] or [create][purge] links from the data table.
-- @data - a table of data generated by p.makeStartBoxLinksData
-- @data - a table of data generated by p.makeStartBoxLinksData
--]]
--]]
local docTitle = data.docTitle
local docTitle = data.docTitle
local title = data.title
local title = data.title
local purgeLink = makeUrlLink(title:fullUrl{action = 'purge'}, data.purgeLinkDisplay)
if docTitle.exists then
if docTitle.exists then
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local viewLink = makeWikilink(docTitle.prefixedText, data.viewLinkDisplay)
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay)
local editLink = makeUrlLink(docTitle:fullUrl{action = 'edit'}, data.editLinkDisplay)
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay)
local historyLink = makeUrlLink(docTitle:fullUrl{action = 'history'}, data.historyLinkDisplay)
ret = '[%s] [%s] [%s] [%s]'
ret = '[%s] [%s] [%s] [%s]'
ret = escapeBrackets(ret)
ret = escapeBrackets(ret)
else
else
local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
local createLink = makeUrlLink(docTitle:fullUrl{action = 'edit', preload = data.preload}, data.createLinkDisplay)
ret = '[%s]'
ret = '[%s] [%s]'
ret = escapeBrackets(ret)
ret = escapeBrackets(ret)
ret = mw.ustring.format(ret, createLink)
ret = mw.ustring.format(ret, createLink, purgeLink)
end
end
return ret
return ret
:tag('span')
:tag('span')
:addClass(data.headingClass)
:addClass(data.headingClass)
:attr('id', 'documentation-heading')
:cssText(data.headingStyleText)
:cssText(data.headingStyleText)
:wikitext(data.heading)
:wikitext(data.heading)
end
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
end
end
end
end
)
)
return message('subpages-blurb', {subpagesLink})
return message('subpages-blurb', {subpagesLink})
end
end