第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) |
第369行: |
第395行: |
| pagetypee = message('module-pagetype') | | pagetypee = message('module-pagetype') |
| else | | else |
− | pagetypee = message('other-pagetype') | + | pagetypee = message('default-pagetype')--message 'other-pagetype' 不存在 |
| end | | end |
| local templateLink = makeWikilink(templateTitle.prefixedText) | | local templateLink = makeWikilink(templateTitle.prefixedText) |
第740行: |
第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 |