Module:Documentation: Difference between revisions

Content added Content deleted
(latest change added)
(use title.protectionLevels instead of {{PROTECTIONLEVEL}} in p.protectionTemplate)
Line 170: Line 170:
--
--
-- Data includes:
-- Data includes:
-- env.protectionLevels - the protection levels table of the title object.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.subjectSpace - the number of the title's subject namespace.
-- env.docSpace - the number of the namespace the title puts its documentation in.
-- env.docSpace - the number of the namespace the title puts its documentation in.
Line 269: Line 270:
--]]
--]]
return env.templateTitle:subPageTitle(message('print-subpage'))
return env.templateTitle:subPageTitle(message('print-subpage'))
end

function envFuncs.protectionLevels()
-- The protection levels table of the title object.
return env.title.protectionLevels
end
end


Line 330: Line 336:
-- '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' --> '[[w:Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-template' --> '[[Wikipedia:Template test cases|template sandbox]] page'
-- 'sandbox-notice-pagetype-module' --> '[[w:Wikipedia: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 393: Line 399:
-- 'protection-template-args' --> {docusage = 'yes'}
-- 'protection-template-args' --> {docusage = 'yes'}
local title = env.title
local title = env.title
local protectionLevels
local protectionTemplate = message('protection-template')
local protectionTemplate = message('protection-template')
local namespace = title.namespace
local namespace = title.namespace
Line 399: Line 406:
return nil
return nil
end
end
protectionLevels = env.protectionLevels
local frame = mw.getCurrentFrame()
local editLevels = protectionLevels.edit
local function getProtectionLevel(protectionType, page)
local moveLevels = protectionLevels.move
-- Gets the protection level for page, or for the current page if page is not specified.
if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then
local level = frame:callParserFunction('PROTECTIONLEVEL', protectionType, page)
if level ~= '' then
return level
else
return nil -- The parser function returns the blank string if there is no match.
end
end
local prefixedTitle = title.prefixedText
if getProtectionLevel('move', prefixedTitle) == 'sysop' or getProtectionLevel('edit', prefixedTitle) then
-- The page is full-move protected, or full, template, or semi-protected.
-- The page is full-move protected, or full, template, or semi-protected.
local frame = mw.getCurrentFrame()
return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')}
return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')}
else
return nil
end
end
return nil
end
end


Line 734: Line 735:
-- 'history-link-display' --> 'history'
-- 'history-link-display' --> 'history'
-- 'transcluded-from-blurb' -->
-- 'transcluded-from-blurb' -->
-- 'The above [[w:Wikipedia:Template documentation|documentation]]
-- 'The above [[Wikipedia:Template documentation|documentation]]
-- is [[w:Wikipedia: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 [[w:Wikipedia: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 924: Line 925:
-- Messages:
-- Messages:
-- 'print-link-display' --> '/Print'
-- 'print-link-display' --> '/Print'
-- 'print-blurb' --> 'A [[w:Help:Books/for experts#Improving the book layout|print version]]'
-- 'print-blurb' --> 'A [[Help:Books/for experts#Improving the book layout|print version]]'
-- .. ' of this template exists at $1.'
-- .. ' of this template exists at $1.'
-- .. ' If you make a change to this template, please update the print version as well.'
-- .. ' If you make a change to this template, please update the print version as well.'
Line 959: Line 960:
-- 'doc-subpage' --> 'doc'
-- 'doc-subpage' --> 'doc'
-- 'testcases-subpage' --> 'testcases'
-- 'testcases-subpage' --> 'testcases'
-- 'strange-usage-category' --> 'Wikisource 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
Cookies help us deliver our services. By using our services, you agree to our use of cookies.