モジュール:SockActiveList

モジュールの解説[表示] [編集] [履歴] [キャッシュを破棄]

このモジュールは過去に{{SockActiveList}}の内部モジュールとして使用されていましたが、後に廃止されました。

使用法[編集]

{{#invoke:SockActiveList|main}}

関連項目[編集]

local p={}
local WRAPPER = 'Template:SockActiveList'

function p.main( frame )
	local args = require( 'Module:Arguments' ).getArgs( frame, { wrappers = WRAPPER })

	if args[1] == '' or nil then
		return p.error('リスト定義が指定されていません。')
	end

	local name = mw.text.split( args[1], ',' ) or '' --name label
	local list = mw.text.split( args[2], ',' ) or '' --active list

	local line = ''
	local temp = ''
	for i, val in pairs ( name ) do

		if name[i] ~= '' and name[i] ~= 'null' then
			temp = '[[Wikipedia:管理者伝言板/投稿ブロック/ソックパペット#' ..name[i] ..'|' ..name[i] ..']]'
		end

		for k, val in pairs ( list ) do
			if name[i] ~= '' and name[i] ~= 'null' and name[i] == list[k] then
				temp ='<span style="background: #fdd; font-weight: bold;">' ..temp ..'</span>'
			end
		end
		line = line ..'* ' ..temp ..'\n'
	end

	return line
end

function p.error ( message )
	return '<strong class="error">エラー:' ..message ..'</strong>'
end

return p