Модуль:Вікіпедія Шафа

{{i}} Документація модуля[створити]
local p = {}

function p.small(frame)
	articles = tonumber(frame.args[1]);
	articles_in_book = 2250;
	books_in_stack = 200;
	stack = articles_in_book * books_in_stack;
	ten_stacks = 10 * stack;
	hundred_stacks = 100 * stack;
	
	res = {'{|\n|-\n| valign="top" rowspan="', math.ceil(articles/ten_stacks), 
		'" | <div style="margin-top:70px">[[File:Human outline.svg|55px]]</div>'};
	
	i = 1;
	while(articles>=ten_stacks) do
		if(i>1) then table.insert(res, '\n|-'); end
		table.insert(res, "\n{{Вікіпедія:Шафа/10шаф-мал}}\n| '''"..i.."'''");
		articles = articles - ten_stacks;
		i = i + 1;
	end
	
	i = 1;
	if(articles>=stack) then
		table.insert(res, '\n|-');
		while(articles>=stack) do
			table.insert(res, '\n| {{Вікіпедія:Шафа/200мал}}');
			articles = articles - stack;
			i = i + 1;
		end
		table.insert(res, '\n| {{Вікіпедія:Шафа/200т-мал}}');
	else table.insert(res, '\n|-\n| {{Вікіпедія:Шафа/200т-мал}}'); end
	
	table.insert(res, '\n|}');
	
	return frame:preprocess(table.concat(res));
end

return p;