rm alt text on icon, since the adjacent text, "Template documentation" or "Module documentation", is sufficient alternative text (per edit request)
template>K-iczn (en:Module:Documentation 2016年6月17日 (金) 01:32(UTC)より) |
module:infobox>Andy M. Wang (rm alt text on icon, since the adjacent text, "Template documentation" or "Module documentation", is sufficient alternative text (per edit request)) |
||
33行目: | 33行目: | ||
expectType = expectType or 'string' | expectType = expectType or 'string' | ||
if type(msg) ~= expectType then | if type(msg) ~= expectType then | ||
error(' | error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2) | ||
end | end | ||
if not valArray then | if not valArray then | ||
41行目: | 41行目: | ||
local function getMessageVal(match) | local function getMessageVal(match) | ||
match = tonumber(match) | match = tonumber(match) | ||
return valArray[match] or error(' | return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4) | ||
end | end | ||
129行目: | 129行目: | ||
local root = mw.html.create() | local root = mw.html.create() | ||
root | root | ||
:wikitext(p.protectionTemplate(env)) | |||
:wikitext(p.sandboxNotice(args, env)) | :wikitext(p.sandboxNotice(args, env)) | ||
-- This div tag is from {{documentation/start box}}, but moving it here | -- This div tag is from {{documentation/start box}}, but moving it here | ||
139行目: | 139行目: | ||
:wikitext(p._startBox(args, env)) | :wikitext(p._startBox(args, env)) | ||
:wikitext(p._content(args, env)) | :wikitext(p._content(args, env)) | ||
:tag('div') | :tag('div') | ||
:css('clear', 'both') -- So right or left floating items don't stick out of the doc box. | :css('clear', 'both') -- So right or left floating items don't stick out of the doc box. | ||
275行目: | 270行目: | ||
end | end | ||
function envFuncs.protectionLevels() | |||
-- The protection levels table of the title object. | -- The protection levels table of the title object. | ||
return env.title.protectionLevels | |||
end | |||
function envFuncs.subjectSpace() | function envFuncs.subjectSpace() | ||
401行目: | 396行目: | ||
end | end | ||
function p.protectionTemplate(env) | |||
-- Generates the padlock icon in the top right. | -- Generates the padlock icon in the top right. | ||
-- @env - environment table containing title objects, etc., generated with p.getEnvironment | -- @env - environment table containing title objects, etc., generated with p.getEnvironment | ||
407行目: | 402行目: | ||
-- '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 | |||
protectionLevels = env.protectionLevels | |||
if not protectionLevels then | |||
return nil | |||
end | |||
local editProt = protectionLevels.edit and protectionLevels.edit[1] | |||
local moveProt = protectionLevels.move and protectionLevels.move[1] | |||
if editProt then | |||
-- The page is edit-protected. | -- The page is edit-protected. | ||
mProtectionBanner = require('Module:Protection banner') | |||
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 | -- The page is move-protected but not edit-protected. Exclude move | ||
-- protection with the level "autoconfirmed", as this is equivalent to | -- protection with the level "autoconfirmed", as this is equivalent to | ||
-- no move protection at all. | -- no move protection at all. | ||
mProtectionBanner = require('Module:Protection banner') | |||
return mProtectionBanner._main{action = 'move', small = true} | |||
else | |||
return nil | |||
end | |||
end | |||
---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ||
555行目: | 550行目: | ||
-- | -- | ||
-- Messages: | -- Messages: | ||
-- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt= | -- 'documentation-icon-wikitext' --> '[[File:Test Template Info-Icon - Version (2).svg|50px|link=|alt=]]' | ||
-- 'template-namespace-heading' --> 'Template documentation' | -- 'template-namespace-heading' --> 'Template documentation' | ||
-- 'module-namespace-heading' --> 'Module documentation' | -- 'module-namespace-heading' --> 'Module documentation' |