62
edits
m (Reverted edits by Bgwhite (talk) to last revision by Tito Dutta) |
(Reverted to revision 18002 by Mr. Stradivarius (talk): Test. (TW)) |
||
Line 170: | Line 170: | ||
-- | -- | ||
-- Data includes: | -- Data includes: | ||
-- 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 270: | Line 269: | ||
--]] | --]] | ||
return env.templateTitle:subPageTitle(message('print-subpage')) | return env.templateTitle:subPageTitle(message('print-subpage')) | ||
end | end | ||
Line 387: | Line 381: | ||
text = text .. makeCategoryLink(message('sandbox-category')) | text = text .. makeCategoryLink(message('sandbox-category')) | ||
omargs.text = text | omargs.text = text | ||
return messageBox.main('ombox', omargs) | |||
end | end | ||
Line 399: | Line 391: | ||
-- 'protection-template-args' --> {docusage = 'yes'} | -- 'protection-template-args' --> {docusage = 'yes'} | ||
local title = env.title | local title = env.title | ||
local protectionTemplate = message('protection-template') | local protectionTemplate = message('protection-template') | ||
local namespace = title.namespace | local namespace = title.namespace | ||
Line 406: | Line 397: | ||
return nil | return nil | ||
end | end | ||
local frame = mw.getCurrentFrame() | |||
local | local function getProtectionLevel(protectionType, page) | ||
local | -- Gets the protection level for page, or for the current page if page is not specified. | ||
if | 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. | ||
return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')} | return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')} | ||
end | end | ||
return nil | |||
end | end | ||
Line 638: | Line 635: | ||
if not content and docTitle and docTitle.exists then | if not content and docTitle and docTitle.exists then | ||
local frame = mw.getCurrentFrame() | local frame = mw.getCurrentFrame() | ||
content = frame: | content = frame:preprocess('{{ ' .. 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 |