Module:Sandbox/CAS222222221

This is an old revision of this page, as edited by 風中的刀劍 (talk | contribs) at 04:14, 11 December 2014. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local getArgs = require('Module:Arguments').getArgs
 
local p = {}

categoryList = {
	{'fa', '特色'},
	{'a', '甲'},
	{'ga', '优良'},
	{'b', '乙'},
	{'c', '丙'},
	{'start', '初'},
	{'stub', '小作品'},
	{'fl', '特色列表'},
	{'list', '列表'},
	
	{'category', '分类'},
	{'disambig', '消歧义'},
	{'file', '文件'},
	{'portal', '主题'},
	{'project', '专题'},
	{'template', '模板'},
	{'na', '非条目'},
	{'unassessed', '未评'},

}

importanceList = {
	{'top', '极高'},
	{'high', '高'},
	{'mid', '中'},
	{'low', '低'},
	{'bottom', '极低'},
	{'no', '无'},
	{'na','不适用'},
	{'unknown', '未知'},
}

function projectName( ... )
	local ret
	
	if _agrs.taskforce ~= '' then
		ret = _agrs.taskforce
	else
		ret = _agrs.project
	end
	
	return ret
end

function classCategory( ... )
	local ret

	if _agrs.classCode ~= 'total' then
		ret = categoryList[_agrs.classCode][2] .. '级' .. proj .. '条目'
	else
		ret = ''
	end
	
	return ret
end

function importanceCategory( ... )
	local ret
	
	if importanceCode ~= 'total' then
		ret = importanceList[_agrs.importanceCode][2] .. '重要度' .. _agrs.proj .. '条目'
	else
		ret = ''
	end
	
	return ret
end

function url( ... )
	
	local ret
	
	ret =	mw.uri.fullUrl(
			'toollabs:catscan2/catscan2.php',
			'language=zh&' .. 
			'categories=' .. classCategory(_agrs.classCode, _agrs.proj) .. '%0D%0A' .. importanceCategory(_agrs.importanceCode, _agrs.proj) .. '&' .. 
			'ns[1]=1&ns[3]=1&ns[5]=1&ns[7]=1&ns[9]=1&ns[11]=1&ns[13]=1&ns[15]=1&ns[101]=1&ns[829]&' .. 
			'templates_yes=' .. _agrs.template .. '&' ..
			'doit=1' 
		)
	
end

function numberWithUrl( ... )
	local ret
	ret = 	'[' ..
			url(_agrs) ..
			' ' ..
			number ..
			']'
	return ret
end

function p.main(args)
local args = getArgs(frame, {
		valueFunc = function (key, value)
			if key == '' or key == nil then
				value = ''
			end
			return value
		end 
		})
-- Main module code goes here.
	_args = {
		classCode = 1,
		importanceCode = 2,
		project = 'Projj',
		number = args[ga_low],
	}
	
	return numberWithUrl(_args)
end

return p