跳转到内容

模組:Indicator

被永久保护的模块
维基百科,自由的百科全书

这是本页的一个历史版本,由Kovl留言 | 贡献2015年2月25日 (三) 08:20编辑。这可能和当前版本存在着巨大的差异。

--模块控制indicator功能
local getArgs = require('Module:Arguments').getArgs
local p = {}
 
function p.main(frame)
	local args = getArgs(frame)
	local text
	
	if args.image then
		text = '[[File:' .. args.image .. '|' .. (args.size or '24px') .. '|' .. args.alt .. '|link=' .. args.link .. ']]'
	end
	if args.text  then
		local temptext = args.text
		if args.fontsize then
			temptext = tostring( mw.html.create( 'span' ):css( 'font-size', args.fontsize ):wikitext( args.text ) )
		end
		text = text .. temptext
	end
	if args.title then
		text = tostring( mw.html.create( 'div' ):attr( 'title', args.title ):wikitext( text ) )
	end
	
	if text and text  ~= '' then
		return frame:extensionTag{
			name = 'indicator',
			content = text,
			args = { name = string.format( '%x', require( 'Module:Crc32lua' ).crc32( text ) ) },
		}
	else
		return
	end
end

return p