模块:STConversion
外观
此模块的文档可以在模块:STConversion/doc创建
local p = {}
local fallbackString = mw.getCurrentFrame():extensionTag('nowiki')
local function item( variant, content )
if not content then
return ''
end
if string.match( content, '^()%s*$' ) then
return variant .. ':' .. fallbackString .. ';'
end
return variant .. ':' .. string.match( content, '^.*%S' ) .. ';'
end
function p.call( args )
return '-{' .. ( args.mode and ( args.mode .. '|' ) or '' ) ..
item( 'zh-cn', args[ 'zh-cn' ] or args[ 1 ] ) ..
item( 'zh-tw', args[ 'zh-tw' ] or args[ 2 ] ) ..
item( 'zh-hk', ( args.closehkinherit and '' ) or args[ 'zh-hk' ] or args[ 3 ] ) ..
'}-'
end
function p.main( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
end
return p.call( args )
end
return p