「モジュール:Documentation」の版間の差分
ナビゲーションに移動
検索に移動
en:Module:Documentation oldid=885570031 より更新
Triple-Zeta (トーク | 投稿記録) 細 (1版 をインポートしました) |
template>ネイ (en:Module:Documentation oldid=885570031 より更新) |
||
33行目: | 33行目: | ||
expectType = expectType or 'string' | expectType = expectType or 'string' | ||
if type(msg) ~= expectType then | if type(msg) ~= expectType then | ||
error(' | error('メッセージ: メッセージ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('メッセージ: メッセージCFGにおいて$' .. match .. 'キーへの値の入力が必要です。' .. cfgKey, 4) | ||
end | end | ||
129行目: | 129行目: | ||
local root = mw.html.create() | local root = mw.html.create() | ||
root | root | ||
:wikitext(p.protectionTemplate(env)) | -- :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 | ||
270行目: | 270行目: | ||
end | end | ||
function envFuncs.protectionLevels() | -- function envFuncs.protectionLevels() | ||
-- The protection levels table of the title object. | -- The protection levels table of the title object. | ||
return env.title.protectionLevels | -- return env.title.protectionLevels | ||
end | -- end | ||
function envFuncs.subjectSpace() | function envFuncs.subjectSpace() | ||
376行目: | 376行目: | ||
local testcasesTitle = env.testcasesTitle | local testcasesTitle = env.testcasesTitle | ||
if testcasesTitle and testcasesTitle.exists then | if testcasesTitle and testcasesTitle.exists then | ||
if testcasesTitle. | if testcasesTitle.contentModel == "Scribunto" then | ||
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') | local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display') | ||
local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') | local testcasesRunLinkDisplay = message('sandbox-notice-testcases-run-link-display') | ||
396行目: | 396行目: | ||
end | end | ||
function p.protectionTemplate(env) | -- 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 | ||
402行目: | 402行目: | ||
-- 'protection-template' --> 'pp-template' | -- 'protection-template' --> 'pp-template' | ||
-- 'protection-template-args' --> {docusage = 'yes'} | -- 'protection-template-args' --> {docusage = 'yes'} | ||
local protectionLevels, mProtectionBanner | -- local protectionLevels, mProtectionBanner | ||
local title = env.title | -- local title = env.title | ||
protectionLevels = env.protectionLevels | -- protectionLevels = env.protectionLevels | ||
if not protectionLevels then | -- if not protectionLevels then | ||
return nil | -- return nil | ||
end | -- end | ||
local editProt = protectionLevels.edit and protectionLevels.edit[1] | -- local editProt = protectionLevels.edit and protectionLevels.edit[1] | ||
local moveProt = protectionLevels.move and protectionLevels.move[1] | -- local moveProt = protectionLevels.move and protectionLevels.move[1] | ||
if editProt then | -- if editProt then | ||
-- The page is edit-protected. | -- The page is edit-protected. | ||
mProtectionBanner = require('Module:Protection banner') | -- mProtectionBanner = require('Module:Protection banner') | ||
local reason = message('protection-reason-edit') | -- local reason = message('protection-reason-edit') | ||
return mProtectionBanner._main{reason, small = true} | -- return mProtectionBanner._main{reason, small = true} | ||
elseif moveProt and moveProt ~= 'autoconfirmed' then | -- 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') | -- mProtectionBanner = require('Module:Protection banner') | ||
return mProtectionBanner._main{action = 'move', small = true} | -- return mProtectionBanner._main{action = 'move', small = true} | ||
else | -- else | ||
return nil | -- return nil | ||
end | -- end | ||
end | -- end | ||
---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ||
483行目: | 483行目: | ||
if not title or not docTitle then | if not title or not docTitle then | ||
return nil | return nil | ||
end | |||
if docTitle.isRedirect then | |||
docTitle = docTitle.redirectTarget | |||
end | end | ||
870行目: | 873行目: | ||
local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) | local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay) | ||
-- for Modules, add testcases run link if exists | -- for Modules, add testcases run link if exists | ||
if | if testcasesTitle.contentModel == "Scribunto" and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then | ||
local testcasesRunLinkDisplay = message('testcases-run-link-display') | local testcasesRunLinkDisplay = message('testcases-run-link-display') | ||
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) | local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay) |