Module:Documentation: Difference between revisions

no edit summary
m (→‎top: clean up, replaced: Wikipedia: → Bharatpedia: (4))
No edit summary
Line 842: Line 842:
-- Make links.
-- Make links.
local sandboxLinks, testcasesLinks
local sandboxLinks, testcasesLinks
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('sandbox-link-display')
local sandboxDisplay = message('sandbox-link-display')
Line 856: Line 855:
end
end
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
sandboxLinks = sandboxLink .. ' ' .. makeToolbar(sandboxEditLink, compareLink)
else
local sandboxPreload
local sandboxPreload
if subjectSpace == 828 then
if subjectSpace == 828 then
sandboxPreload = message('module-sandbox-preload')
sandboxPreload = message('module-sandbox-preload')
Line 910: Line 908:
end
end
return message(messageName, {sandboxLinks, testcasesLinks})
return message(messageName, {sandboxLinks, testcasesLinks})
end
function p.makeCategoriesBlurb(args, env)
--[[
--[[
-- Generates the text "Please add categories to the /doc subpage."
-- Generates the text "Please add categories to the /doc subpage."
Line 921: Line 916:
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
-- 'add-categories-blurb' --> 'Please add categories to the $1 subpage.'
--]]
--]]
local docTitle = env.docTitle
if not docTitle then
return nil
end
local docPathLink = makeWikilink(docTitle.prefixedText, message('doc-link-display'))
return message('add-categories-blurb', {docPathLink})
end
function p.makeSubpagesBlurb(args, env)
--[[
--[[
-- Generates the "Subpages of this template" link.
-- Generates the "Subpages of this template" link.
Line 941: Line 927:
-- 'subpages-link-display' --> 'Subpages of this $1'
-- 'subpages-link-display' --> 'Subpages of this $1'
--]]
--]]
local subjectSpace = env.subjectSpace
local templateTitle = env.templateTitle
if not subjectSpace or not templateTitle then
return nil
end
local pagetype
if subjectSpace == 10 then
pagetype = message('template-pagetype')
elseif subjectSpace == 828 then
pagetype = message('module-pagetype')
else
pagetype = message('default-pagetype')
end
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
message('subpages-link-display', {pagetype})
)
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.
-- Generates the blurb displayed when there is a print version of the template available.
Line 975: Line 943:
-- 'print-category' --> 'Templates with print versions'
-- '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
----------------------------------------------------------------------------
----------------------------------------------------------------------------
-- Tracking categories
-- Tracking categories
----------------------------------------------------------------------------
----------------------------------------------------------------------------


function p.addTrackingCategories(env)
--[[
--[[
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
-- Check if {{documentation}} is transcluded on a /doc or /testcases page.
Line 1,009: Line 960:
-- {{documentation}} transcluded automatically.
-- {{documentation}} transcluded automatically.
--]]
--]]
local title = env.title
local subjectSpace = env.subjectSpace
if not title or not subjectSpace then
return nil
end
local subpage = title.subpageText
local ret = ''
if message('display-strange-usage-category', nil, 'boolean')
and (
and (
subpage == message('doc-subpage')
subpage == message('doc-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
or subjectSpace ~= 828 and subpage == message('testcases-subpage')
)
)
then
ret = ret .. makeCategoryLink(message('strange-usage-category'))
end
return ret
end
return p