今天是2026年7月3日 第27周 星期五

代人,时大变了。

我们生活在大地上,但我们的梦想超越天空。

變更

跳至導覽 跳至搜尋
增加 1,055 位元組 、 2023年12月24日 (日) 19:41
导入1个版本
行 108: 行 108:  
})
 
})
 
return p[funcName](args)
 
return p[funcName](args)
 +
end
 +
end
 +
 +
----------------------------------------------------------------------------
 +
-- Entry points
 +
----------------------------------------------------------------------------
 +
 +
function p.nonexistent(frame)
 +
if mw.title.getCurrentTitle().subpageText == 'testcases' then
 +
return frame:expandTemplate{title = 'module test cases notice'}
 +
else
 +
return p.main(frame)
 
end
 
end
 
end
 
end
行 129: 行 141:  
local root = mw.html.create()
 
local root = mw.html.create()
 
root
 
root
 +
:wikitext(p._getModuleWikitext(args, env))
 
:wikitext(p.protectionTemplate(env))
 
:wikitext(p.protectionTemplate(env))
 
:wikitext(p.sandboxNotice(args, env))
 
:wikitext(p.sandboxNotice(args, env))
行 323: 行 336:  
-- Auxiliary templates
 
-- Auxiliary templates
 
----------------------------------------------------------------------------
 
----------------------------------------------------------------------------
 +
p.getModuleWikitext = makeInvokeFunc('_getModuleWikitext')
 +
 +
function p._getModuleWikitext(args, env)
 +
local currentTitle = mw.title.getCurrentTitle()
 +
if currentTitle.contentModel ~= 'Scribunto' then return end
 +
pcall(require, currentTitle.prefixedText) -- if it fails, we don't care
 +
local moduleWikitext =  package.loaded["Module:Module wikitext"]
 +
if moduleWikitext then
 +
return moduleWikitext.main()
 +
end
 +
return ''
 +
end
 +
    
function p.sandboxNotice(args, env)
 
function p.sandboxNotice(args, env)
行 362: 行 388:  
else
 
else
 
pagetype = message('sandbox-notice-pagetype-other')
 
pagetype = message('sandbox-notice-pagetype-other')
 +
end
 +
local pagetypee
 +
if subjectSpace == 10 then
 +
pagetypee = message('template-pagetype')
 +
elseif subjectSpace == 828 then
 +
pagetypee = message('module-pagetype')
 +
else
 +
pagetypee = message('default-pagetype')--message 'other-pagetype' 不存在
 
end
 
end
 
local templateLink = makeWikilink(templateTitle.prefixedText)
 
local templateLink = makeWikilink(templateTitle.prefixedText)
行 376: 行 410:  
local testcasesTitle = env.testcasesTitle
 
local testcasesTitle = env.testcasesTitle
 
if testcasesTitle and testcasesTitle.exists then
 
if testcasesTitle and testcasesTitle.exists then
if testcasesTitle.contentModel == "Scribunto" then
+
if testcasesTitle.namespace == mw.site.namespaces.Module.id 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')
 
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
 
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
 
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
 
local testcasesRunLink = makeWikilink(testcasesTitle.talkPageTitle.prefixedText, testcasesRunLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-run-blurb', {testcasesLink, testcasesRunLink})
+
text = text .. '<br /><small>' .. message('sandbox-notice-testcases-run-blurb', {pagetypee, testcasesLink, testcasesRunLink}) .. '</small>'
 
else
 
else
 
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
 
local testcasesLinkDisplay = message('sandbox-notice-testcases-link-display')
 
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
 
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('sandbox-notice-testcases-blurb', {testcasesLink})
+
text = text .. '<br /><small>' .. message('sandbox-notice-testcases-blurb', {pagetypee, testcasesLink}) .. '</small>'
 
end
 
end
 
end
 
end
行 445: 行 479:  
local links
 
local links
 
local content = args.content
 
local content = args.content
if not content or args[1] then
+
if not content then
 
-- No need to include the links if the documentation is on the template page itself.
 
-- No need to include the links if the documentation is on the template page itself.
 
local linksData = p.makeStartBoxLinksData(args, env)
 
local linksData = p.makeStartBoxLinksData(args, env)
行 483: 行 517:  
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
   行 735: 行 766:  
text = text .. (p.makeCategoriesBlurb(args, env) or '')
 
text = text .. (p.makeCategoriesBlurb(args, env) or '')
 
end
 
end
text = text .. ' ' .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
+
text = text .. (p.makeSubpagesBlurb(args, env) or '') --"Subpages of this template"
 
local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates.
 
local printBlurb = p.makePrintBlurb(args, env) -- Two-line blurb about print versions of templates.
 
if printBlurb then
 
if printBlurb then
行 873: 行 904:  
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 testcasesTitle.contentModel == "Scribunto"  and testcasesTitle.talkPageTitle and testcasesTitle.talkPageTitle.exists then
+
if subjectSpace == 828 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)

導覽選單