Module:Documentation: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
m (25 revisions imported from mw:Module:Documentation) |
(Remove all print subpage related code as they are being deleted (and non-functional)) |
||
Line 177: | Line 177: | ||
-- env.sandboxTitle - the /sandbox subpage. |
-- env.sandboxTitle - the /sandbox subpage. |
||
-- env.testcasesTitle - the /testcases subpage. |
-- env.testcasesTitle - the /testcases subpage. |
||
-- env.printTitle - the print version of the template, located at the /Print subpage. |
|||
-- |
-- |
||
-- Data includes: |
-- Data includes: |
||
Line 271: | Line 270: | ||
--]] |
--]] |
||
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) |
return mw.title.new(env.docpageBase .. '/' .. message('testcases-subpage')) |
||
end |
|||
function envFuncs.printTitle() |
|||
--[[ |
|||
-- Title object for the /Print subpage. |
|||
-- Messages: |
|||
-- 'print-subpage' --> 'Print' |
|||
--]] |
|||
return env.templateTitle:subPageTitle(message('print-subpage')) |
|||
end |
end |
||
Line 740: | Line 730: | ||
end |
end |
||
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template" |
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template" |
||
local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates. |
|||
if printBlurb then |
|||
text = text .. '<br />' .. printBlurb |
|||
end |
|||
end |
end |
||
end |
end |
||
Line 960: | Line 946: | ||
) |
) |
||
return message('subpages-blurb', {subpagesLink}) |
return message('subpages-blurb', {subpagesLink}) |
||
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 |
|||
end |
end |
||