跳转到内容

模組:Articles by Quality and Importance/sandbox

维基百科,自由的百科全书

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

local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')

local classList = {	
	{'fa', '特色'},
	{'a', '甲'},
	{'ga', '优良'},
	{'b', '乙'},
	{'c', '丙'},
	{'start', '初'},
	{'stub', '小作品'},
	{'fl', '特色列表'},
	{'list', '列表'},
	{'category', '分类'},
	{'disambig', '消歧义'},
	{'file', '文件'},
	{'portal', '主题'},
	{'project', '专题'},
	{'template', '模板'},
	{'na', '不适用'},
	{'unassessed', '未评'}
}
local importanceList = {
	{'top', '极高'},
	{'high', '高'},
	{'mid', '中'},
	{'low', '低'},
	{'na', '不适用'},
	{'unknown', '未知'}
}
local classExtendedList = { 'category', 'disambig', 'file', 'portal', 'project', 'template' }

local function count(args, v, w)

end

local p = {}

function p.main(frame)
	local args = getArgs(frame)

	if yesno( args.extended ) == no then
		for i, v in ipairs( classExtendedList ) do
			args[v[1] .. '_'] = no
		end
	end

	for i, v in ipairs( classList ) do
		if yesno( args[v[1] .. '_'] ) ~= false then
			for j, w in ipairs( importanceList ) do
				if yesno( args[w[1] .. '_'] ) ~= false then
					args[v[1] .. '_total'] = args[v[1] .. '_total'] + args[v[1] .. '_' .. w[1]]
					args['total_' .. w[1]] = args['total_' .. w[1]] + args[v[1] .. '_' .. w[1]]
				end
			end
		end
	end
	
	return p._main(args)
end
 
function p._main(args)
	-- Main module code goes here.
end
 
return p