Module:Documentation: Difference between revisions

Jump to navigation Jump to search
revert
(clean up)
(revert)
 
(14 intermediate revisions by the same user not shown)
Line 146: Line 146:
.done()
.done()
.wikitext(p._endBox(args, env))
.wikitext(p._endBox(args, env))
.newline()
.wikitext(p.addTrackingCategories(env))
.wikitext(p.addTrackingCategories(env))
return tostring(root)
return tostring(root)
Line 333: Line 332:
--  
--  
-- Messages:
-- Messages:
-- 'sandbox-notice-image' --> '[[Image:Sandbox.png|50px|alt=|link=]]'
-- 'sandbox-notice-image' --> '[[Image:Sandbox.svg|50px|alt=|link=]]'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-blurb' --> 'This is the $1 for $2.'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-diff-blurb' --> 'This is the $1 for $2 ($3).'
-- 'sandbox-notice-pagetype-template' --> '[[Sarkarverse:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Sarkarverse:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[Wikipedia:Template test cases|module sandbox]] page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-pagetype-other' --> 'sandbox page'
-- 'sandbox-notice-compare-link-display' --> 'diff'
-- 'sandbox-notice-compare-link-display' --> 'diff'
Line 380: Line 379:
local testcasesTitle = env.testcasesTitle
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle and testcasesTitle.exists then
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
if testcasesTitle.namespace == mw.site.namespaces.Module.id then
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
else
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
end
end
end
-- Add the sandbox to the sandbox category.
-- Add the sandbox to the sandbox category.
Line 398: Line 405:
-- 'protection-template' --> 'pp-template'
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels, mProtectionBanner
local title = env.title
local title = env.title
local protectionLevels
if title.namespace ~= 10 and title.namespace ~= 828 then
local protectionTemplate = message('protection-template')
local namespace = title.namespace
if not (protectionTemplate and (namespace == 10 or namespace == 828)) then
-- Don't display the protection template if we are not in the template or module namespaces.
-- Don't display the protection template if we are not in the template or module namespaces.
return nil
return nil
Line 410: Line 415:
return nil
return nil
end
end
local editLevels = protectionLevels.edit
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveLevels = protectionLevels.move
local moveProt = protectionLevels.move and protectionLevels.move[1]
if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then
if editProt then
-- The page is full-move protected, or full, template, or semi-protected.
-- The page is edit-protected.
local frame = mw.getCurrentFrame()
mProtectionBanner = require('Module:Protection banner')
return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')}
local reason = message('protection-reason-edit')
return mProtectionBanner._main{reason, small = true}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
mProtectionBanner = require('Module:Protection banner')
return mProtectionBanner._main{action = 'move', small = true}
else
else
return nil
return nil
Line 545: Line 557:
--
--
-- Messages:
-- Messages:
-- 'documentation-icon-wikitext' --> '[[File:Template-info.png|50px|link=|alt=Documentation icon]]'
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=Documentation icon]]'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'template-namespace-heading' --> 'Template documentation'
-- 'module-namespace-heading' --> 'Module documentation'
-- 'module-namespace-heading' --> 'Module documentation'
Line 640: Line 652:
local content = args.content
local content = args.content
if not content and docTitle and docTitle.exists then
if not content and docTitle and docTitle.exists then
local frame = mw.getCurrentFrame()
content = args._content or mw.getCurrentFrame():expandTemplate{title = docTitle.prefixedText}
content = frame:expandTemplate{title = docTitle.prefixedText}
end
end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- The line breaks below are necessary so that "=== Headings ===" at the start and end
-- of docs are interpreted correctly.
-- of docs are interpreted correctly.
return '\n' .. (content or '') .. '\n'  
return '\n' .. (content or '') .. '\n'  
end
p.contentTitle = makeInvokeFunc('_contentTitle')
function p._contentTitle(args, env)
env = env or p.getEnvironment(args)
local docTitle = env.docTitle
if not args.content and docTitle and docTitle.exists then
return docTitle.prefixedText
else
return ''
end
end
end


Line 708: Line 731:
-- Add sandbox and testcases links.
-- Add sandbox and testcases links.
-- "Editors can experiment in this template's sandbox and testcases pages."
-- "Editors can experiment in this template's sandbox and testcases pages."
text = text .. p.makeExperimentBlurb(args, env)
text = text .. (p.makeExperimentBlurb(args, env) or '')
text = text .. '<br />'
text = text .. '<br />'
if not args.content and not args[1] then
if not args.content and not args[1] then
Line 738: Line 761:
-- 'history-link-display' --> 'history'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->  
-- 'transcluded-from-blurb' -->  
-- 'The above [[Sarkarverse:Template documentation|documentation]]  
-- 'The above [[Wikipedia:Template documentation|documentation]]  
-- is [[Sarkarverse:Transclusion|transcluded]] from $1.'
-- is [[Wikipedia:Transclusion|transcluded]] from $1.'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'module-preload' --> 'Template:Documentation/preload-module-doc'
-- 'create-link-display' --> 'create'
-- 'create-link-display' --> 'create'
-- 'create-module-doc-blurb' -->
-- 'create-module-doc-blurb' -->
-- 'You might want to $1 a documentation page for this [[Sarkarverse:Lua|Scribunto module]].'
-- 'You might want to $1 a documentation page for this [[Wikipedia:Lua|Scribunto module]].'
--]=]
--]=]
local docTitle = env.docTitle
local docTitle = env.docTitle
Line 963: Line 986:
-- 'doc-subpage' --> 'doc'
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Sarkarverse pages with strange ((documentation)) usage'
-- 'strange-usage-category' --> 'Wikipedia pages with strange ((documentation)) usage'
--  
--  
-- /testcases pages in the module namespace are not categorised, as they may have
-- /testcases pages in the module namespace are not categorised, as they may have
14,061

edits

Navigation menu