跳转到内容

模块:Test:修订间差异

来自SS唯基
攸萨留言 | 贡献
无编辑摘要
标签已被回退
攸萨留言 | 贡献
清空全部内容
标签清空 手工回退
第1行: 第1行:
local p = {}


function p.infobox()
local args = require( 'Module:ProcessArgs' ).merge( true )
return args[ 'infobox-body-only' ] and p.body( args ) or p.fullInfobox( args )
end
function p.infoboxBody()
return p.body( require( 'Module:ProcessArgs' ).merge( true ) )
end
function p.infoboxRows()
return p.rows( require( 'Module:ProcessArgs' ).merge( true ) )
end
function p.infoboxRow()
return p.row( require( 'Module:ProcessArgs' ).merge( true ) )
end
function p.row( args )
return mw.html.create( 'div' ):addClass( 'infobox-row' )
:tag( 'div' ):addClass( 'infobox-row-label' ):wikitext( '\n' .. mw.language.getContentLanguage():ucfirst( args[ 1 ] or args.label or '' ) .. '\n' ):done()
:tag( 'div' ):addClass( 'infobox-row-field' ):wikitext( '\n' .. ( args[ 2 ] or args.field or '' ) .. '\n' ):addClass( args.class ):done()
:done()
end
function p.rows( args )
return tostring( mw.html.create( 'div' ):addClass( 'infobox-rows' ):wikitext( args.rows or '' ) ) ..
( args.footer and tostring( mw.html.create( 'div' ):addClass( 'infobox-footer' ):wikitext( args.footer ) ) or '' )
end
function p.body( args )
return mw.ustring.format( '%s\n%s',
args.imagearea or (
require( 'Module:Image area' ).main( args ) ..
( args.extratext and tostring( mw.html.create( 'div' ):addClass( 'infobox-extratext' ):wikitext( args.extratext ) ) or '' )
),
args[ 'infobox-rows' ] or p.rows( args )
)
end
function p.fullInfobox( args )
return require( 'Module:TSLoader' ).call( 'Template:Infobox/styles.css' ) .. tostring(
mw.html.create( 'div' ):addClass( 'notaninfobox tabber-container-infobox' ):addClass( args.infoboxclass )
:tag( 'div' ):addClass( 'mcwiki-header infobox-title' ):wikitext( args.title or mw.title.getCurrentTitle().baseText ):done()
:wikitext( args[ 'infobox-body' ] or p.body( args ) )
)
end
return p

2025年12月14日 (日) 06:36的版本

Documentation icon 模块文档 [-查看-] [编辑] [历史] [刷新]

这个模块是干什么用的?

该模块用于测试,测试完请清空模块内的内容

基本用法

local p = {}

function p.函数名()
return '返回内容'
end

function p.函数名2()
return '返回内容2'
end

return

以上为最基本的用法,其他请自行学习Lua语言

其他

同样也有一个用于测试模板的模板,点这里进入