(页面间差异)
(创建页面,内容为“<includeonly><nowiki>{{</nowiki>[[Template:{{{1}}}|{{{1}}}]]{{t/piece|{{{2|---}}}}}{{t/piece|{{{3|---}}}}}{{t/piece|{{{4|---}}}}}{{t/piece|{{{5|---}}}}}{{t/piece|{{{6|---}}}}}{{t/piece|{{{7|---}}}}}{{t/piece|{{{8|---}}}}}{{t/piece|{{{9|---}}}}}{{t/piece|{{{10|---}}}}}{{t/piece|{{{11|---}}}}}{{t/piece|{{{12|---}}}}}{{t/piece|{{{13|---}}}}}{{t/piece|{{{14|---}}}}}{{t/piece|{{{15|---}}}}}{{t/piece|{{{16|---}}}}}{{t/piece|{{{17|---}}}}}{{t/piece|{{{18|---}}}}}{{t/p…”) |
(创建页面,内容为“-- <nowiki> local dependencyList = require( 'Module:DependencyList' ) local yn = require( 'Module:Yesno' ) local p = {} function p.doc( frame ) local title = mw.title.getCurrentTitle() local args = frame:getParent().args local page = args[1] or mw.ustring.gsub( title.fullText, '/doc$', '' ) local addDependencyList = yn( args.DependencyList or true ) local ret, cats, ret1, ret2, ret3 local onModule = title.namespace == 828 -- su…”) |
||
第1行: | 第1行: | ||
-- <nowiki> | |||
local dependencyList = require( 'Module:DependencyList' ) | |||
local yn = require( 'Module:Yesno' ) | |||
local p = {} | |||
function p.doc( frame ) | |||
local title = mw.title.getCurrentTitle() | |||
local args = frame:getParent().args | |||
local page = args[1] or mw.ustring.gsub( title.fullText, '/doc$', '' ) | |||
local addDependencyList = yn( args.DependencyList or true ) | |||
local ret, cats, ret1, ret2, ret3 | |||
local onModule = title.namespace == 828 | |||
-- subpage header | |||
if title.subpageText == 'doc' then | |||
ret = mw.html.create( nil ) | |||
:tag( 'div' ) | |||
:addClass( 'mbox mbox-low mbox-documentationsub' ) | |||
:attr( 'role', 'presentation') | |||
:tag( 'span' ) | |||
:addClass( 'mbox-title' ) | |||
:tag( 'span' ) | |||
:addClass( 'mbox-icon metadata' ) | |||
:wikitext( '[[File:WikimediaUI-Notice.svg|14px|link=]]' ) | |||
:done() | |||
:wikitext( '这是'.. page ..'的一个文档子页面。' ) | |||
:done() | |||
:tag( 'span' ) | |||
:addClass( 'mbox-text' ) | |||
:wikitext( | |||
string.format( | |||
'它包含了使用信息、分类和其他不属于 [[' .. page .. '|原始 %s 页面]].的内容', | |||
onModule and 'module' or 'template' | |||
) | |||
) | |||
:done() | |||
:done() | |||
:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Mbox/styles.css'} }) | |||
:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Hatnote/styles.css'} }) | |||
:done() | |||
if title.namespace == 10 then -- Template namespace | |||
cats = '[[Category:Template documentation|' .. title.baseText .. ']]' | |||
ret2 = addDependencyList and dependencyList._main() or '' | |||
elseif title.namespace == 828 then -- Module namespace | |||
cats = '[[Category:Module documentation|' .. title.baseText .. ']]' | |||
ret2 = addDependencyList and dependencyList._main() or '' | |||
else | |||
cats = '' | |||
ret2 = '' | |||
end | |||
return tostring( ret ) .. ret2 .. cats | |||
end | |||
-- template header | |||
-- don't use mw.html as we aren't closing the main div tag | |||
ret1 = '<div class="documentation">' | |||
ret2 = mw.html.create( nil ) | |||
:tag( 'div' ) | |||
:addClass( 'documentation-header' ) | |||
:tag( 'span' ) | |||
:addClass( 'documentation-title' ) | |||
:wikitext( string.format('%s documentation', onModule and 'Module' or 'Template') ) | |||
:done() | |||
:tag( 'span' ) | |||
:addClass( 'documentation-links plainlinks' ) | |||
:wikitext( | |||
'[[' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='view'} ) ) .. ' view]]' .. | |||
'[[' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='edit'} ) ) .. ' edit]]' .. | |||
'[[' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='history'} ) ) .. ' history]]' .. | |||
'[<span class="jsPurgeLink">[' .. tostring( mw.uri.fullUrl( title.fullText, {action='purge'} ) ) .. ' purge]</span>]' | |||
) | |||
:done() | |||
:done() | |||
:tag( 'div' ) | |||
:addClass( 'documentation-subheader' ) | |||
:tag( 'span' ) | |||
:addClass( 'documentation-documentation' ) | |||
:wikitext( 'This documentation is transcluded from [[' .. page .. '/doc]]. Changes can be proposed in the talk page.' ) | |||
:done() | |||
:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Mbox/styles.css'} }) | |||
:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Hatnote/styles.css'} }) | |||
:wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Documentation/styles.css'} }) | |||
:done() | |||
ret3 = addDependencyList and dependencyList._main() or '' | |||
return ret1 .. tostring( ret2 ) .. '<div class="documentation-content">' .. ret3 | |||
end | |||
return p | |||
-- </nowiki> |
2023年9月18日 (一) 20:44的版本
This documentation is transcluded from 模块:Documentation/doc. Changes can be proposed in the talk page.
Module:Documentation implements Template:Documentation for templates and modules.
-- <nowiki> local dependencyList = require( 'Module:DependencyList' ) local yn = require( 'Module:Yesno' ) local p = {} function p.doc( frame ) local title = mw.title.getCurrentTitle() local args = frame:getParent().args local page = args[1] or mw.ustring.gsub( title.fullText, '/doc$', '' ) local addDependencyList = yn( args.DependencyList or true ) local ret, cats, ret1, ret2, ret3 local onModule = title.namespace == 828 -- subpage header if title.subpageText == 'doc' then ret = mw.html.create( nil ) :tag( 'div' ) :addClass( 'mbox mbox-low mbox-documentationsub' ) :attr( 'role', 'presentation') :tag( 'span' ) :addClass( 'mbox-title' ) :tag( 'span' ) :addClass( 'mbox-icon metadata' ) :wikitext( '[[File:WikimediaUI-Notice.svg|14px|link=]]' ) :done() :wikitext( '这是'.. page ..'的一个文档子页面。' ) :done() :tag( 'span' ) :addClass( 'mbox-text' ) :wikitext( string.format( '它包含了使用信息、分类和其他不属于 [[' .. page .. '|原始 %s 页面]].的内容', onModule and 'module' or 'template' ) ) :done() :done() :wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Mbox/styles.css'} }) :wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Hatnote/styles.css'} }) :done() if title.namespace == 10 then -- Template namespace cats = '[[Category:Template documentation|' .. title.baseText .. ']]' ret2 = addDependencyList and dependencyList._main() or '' elseif title.namespace == 828 then -- Module namespace cats = '[[Category:Module documentation|' .. title.baseText .. ']]' ret2 = addDependencyList and dependencyList._main() or '' else cats = '' ret2 = '' end return tostring( ret ) .. ret2 .. cats end -- template header -- don't use mw.html as we aren't closing the main div tag ret1 = '<div class="documentation">' ret2 = mw.html.create( nil ) :tag( 'div' ) :addClass( 'documentation-header' ) :tag( 'span' ) :addClass( 'documentation-title' ) :wikitext( string.format('%s documentation', onModule and 'Module' or 'Template') ) :done() :tag( 'span' ) :addClass( 'documentation-links plainlinks' ) :wikitext( '[[' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='view'} ) ) .. ' view]]' .. '[[' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='edit'} ) ) .. ' edit]]' .. '[[' .. tostring( mw.uri.fullUrl( page .. '/doc', {action='history'} ) ) .. ' history]]' .. '[<span class="jsPurgeLink">[' .. tostring( mw.uri.fullUrl( title.fullText, {action='purge'} ) ) .. ' purge]</span>]' ) :done() :done() :tag( 'div' ) :addClass( 'documentation-subheader' ) :tag( 'span' ) :addClass( 'documentation-documentation' ) :wikitext( 'This documentation is transcluded from [[' .. page .. '/doc]]. Changes can be proposed in the talk page.' ) :done() :wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Mbox/styles.css'} }) :wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Hatnote/styles.css'} }) :wikitext(frame:extensionTag{ name = 'templatestyles', args = { src = 'Documentation/styles.css'} }) :done() ret3 = addDependencyList and dependencyList._main() or '' return ret1 .. tostring( ret2 ) .. '<div class="documentation-content">' .. ret3 end return p -- </nowiki>