Warning.png

Поддержка Wiki прекращена, она доступна в режиме архива. Информация в ней устарела и может быть неактуальной.

Модуль:Обжиг — различия между версиями

Материал из Hilarious Wiki
Перейти к: навигация, поиск
м (Тест)
Строка 1: Строка 1:
 
local p = {}
 
local p = {}
 +
local slot = require( [[Модуль:Инвентарный слот]] )
 +
local getParts = slot.getParts
 +
local prefixes = slot.prefixes
 +
 +
local function prefixedLink( name, mod )
 +
local prefix = ''
 +
for _, thisPrefix in pairs( prefixes ) do
 +
if mw.ustring.find(name, '^' .. thisPrefix .. ' ' ) then
 +
prefix = thisPrefix .. ' '
 +
name = mw.ustring.gsub(name, '^' .. prefix, '' )
 +
break
 +
end
 +
end
 +
 +
local page = ''
 +
if mod and mod ~= '' then
 +
page = mod .. '/'
 +
end
 +
 +
local vanilla = {v = 1, vanilla = 1, mc = 1, minecraft = 1}
 +
if mod == '' or vanilla[mw.ustring.lower(parts.mod)] then
 +
return prefix .. name
 +
else
 +
return prefix .. '[[' .. page .. name .. '|' .. name .. ']]'
 +
end
 +
end
 +
 
function p.table( f )
 
function p.table( f )
 
local args = f
 
local args = f
 
if f == mw.getCurrentFrame() then
 
if f == mw.getCurrentFrame() then
args = f:getParent().args
+
args = require( 'Модуль:ProcessArgs' ).merge()
 
else
 
else
 
f = mw.getCurrentFrame()
 
f = mw.getCurrentFrame()
 
end
 
end
local getParts = require( 'Модуль:Инвентарный слот' ).getParts
 
 
 
 
-- Начинать таблицу при необходимости
 
-- Начинать таблицу при необходимости
Строка 17: Строка 43:
 
if multirow then
 
if multirow then
 
head = ''
 
head = ''
elseif head ~= '' then
+
elseif head ~= '' then
multirow = 1
+
multirow = 1
f:callParserFunction( '#dplvar:set', 'multirow', '1' )
+
f:callParserFunction( '#dplvar:set', 'multirow', '1' )
else
+
else
head = 1
+
head = 1
end
+
end
+
 
 
-- Заканчивать таблицу при необходимости
 
-- Заканчивать таблицу при необходимости
 
local foot = args["подвал"] or ''
 
local foot = args["подвал"] or ''
Строка 53: Строка 79:
 
recipeClass = 'class="unsortable" |'
 
recipeClass = 'class="unsortable" |'
 
end
 
end
        local process = ' Процесс'
+
local process = ' Процесс'
        if args["Прогресс"] and args["Мод"] then
+
if args["Прогресс"] and args["Мод"] then
        process=' Процесс'
+
process=' Процесс'
        end
+
end
 
header = table.concat( {
 
header = table.concat( {
 
' {| style="text-align:center" class="wikitable ' .. class .. '" data-description="Процесс"',
 
' {| style="text-align:center" class="wikitable ' .. class .. '" data-description="Процесс"',
 
'! ' .. 'Ингредиенты !! ' .. recipeClass .. process  .. name .. description,
 
'! ' .. 'Ингредиенты !! ' .. recipeClass .. process  .. name .. description,
 
'|-'
 
'|-'
}, '\n' )
+
}, '\n' )
 
end
 
end
 
 
Строка 69: Строка 95:
 
if fuel == '' and (args["Мод"] == 'IndustrialCraft 2' or 'GregTech' and args['Расход'] == 'Электричество') then
 
if fuel == '' and (args["Мод"] == 'IndustrialCraft 2' or 'GregTech' and args['Расход'] == 'Электричество') then
 
fuel = 'Энергия'
 
fuel = 'Энергия'
    elseif fuel == '' then
+
elseif fuel == '' then
fuel = 'v:Любое топливо,1'
+
fuel = 'v:Любое топливо,1'
end
+
end
+
 
 
-- Ячейка с названием
 
-- Ячейка с названием
 
local nameCell
 
local nameCell
 +
if f:callParserFunction( '#dplvar', 'craftingname' ) == '1' then
 
if args["название"] or '' ~= '' then
 
if args["название"] or '' ~= '' then
 
nameCell = args["название"]
 
nameCell = args["название"]
elseif multirow or f:callParserFunction( '#dplvar', 'smeltingname' ) == '1' then
+
else
 
local names = {}
 
local names = {}
 
local links = {}
 
local links = {}
Строка 83: Строка 110:
 
parts = getParts( v, args["Мод"] )
 
parts = getParts( v, args["Мод"] )
 
if not names[( parts.mod or '' ) .. parts.name] and output ~= '' then
 
if not names[( parts.mod or '' ) .. parts.name] and output ~= '' then
local link = ''
+
table.insert( links, prefixedLink( parts.name, parts.mod ) )
if parts.mod then
+
names[parts.mod .. ':' .. parts.name] = 1
link = parts.mod .. '/' .. parts.name .. '|'
 
end
 
             
 
if parts.name:find( '^Люб' ) then
 
if parts.mod then
 
link = parts.mod .. '/' .. mw.ustring.gsub( mw.ustring.sub( parts.name, 7 ), "^%l", mw.ustring.upper ) .. '|'
 
end
 
table.insert( links, mw.ustring.sub( parts.name, 0, 6 ) .. '[[' .. link .. mw.ustring.sub( parts.name, 6 ) .. ']]' )
 
elseif parts.mod == '' then
 
link = parts.name
 
table.insert( links, link )
 
end
 
names[( parts.mod or '' ) .. parts.name] = 1
 
 
end
 
end
 
end
 
end
Строка 103: Строка 117:
 
nameCell = table.concat( links, '&nbsp;или<br>' )
 
nameCell = table.concat( links, '&nbsp;или<br>' )
 
end
 
end
+
end
if nameCell and args["запланированное"] then
+
if nameCell and args["запланированное"] then
nameCell = nameCell .. '<br>(' .. args["запланированное"] .. ')'
+
nameCell = nameCell .. '<br>(' .. args["запланированное"] .. ')'
 +
end
 +
 
 +
-- Создать список ингредиентов
 +
local ingredients = {}
 +
local ingredientKeys = {}
 +
local animatedIngredients = {}
 +
local animatedKeys = {}
 +
for k, v in pairs( args ) do
 +
v = mw.text.trim( v )
 +
if v ~= '' and mw.ustring.find(tostring( k ), '^%u?%d%d?$' ) then
 +
if mw.ustring.find(v, ';' ) then
 +
table.insert( animatedKeys, v )
 +
else
 +
local parts = getParts( v, args["Мод"] )
 +
parts.mod = parts.mod or ''
 +
local fullName = parts.mod .. ':' .. parts.name
 +
if not ingredients[fullName] then
 +
table.insert( ingredientKeys, fullName )
 +
ingredients[fullName] = { mod = parts.mod, name = parts.name }
 +
end
 +
end
 +
end
 +
end
 +
for k, v in ipairs( animatedKeys ) do
 +
local frames = mw.text.split( v, '%s*;%s*' )
 +
local length = #frames
 +
for k2, v2 in ipairs( frames ) do
 +
local parts = getParts( v2, args["Мод"] )
 +
parts.mod = parts.mod or ''
 +
local fullName = parts.mod .. ':' .. parts.name
 +
if v2 ~= '' and not ingredients[fullName] and not animatedIngredients[fullName] then
 +
table.insert( ingredientKeys, fullName )
 +
animatedIngredients[fullName] = { mod = parts.mod, name = parts.name, final = k2 == length }
 +
end
 +
end
 
end
 
end
+
 
 
-- Ячейка с ингредиентами
 
-- Ячейка с ингредиентами
 
local ingredientsCell
 
local ingredientsCell
Строка 114: Строка 163:
 
else
 
else
 
ingredientsCell = {}
 
ingredientsCell = {}
local ingredients = {}
 
 
for k, v in ipairs{ input, fuel } do
 
for k, v in ipairs{ input, fuel } do
local separator = ''
+
local separator = '&nbsp;+'
 
if k == 2 and next( ingredients ) then
 
if k == 2 and next( ingredients ) then
 
separator = '&nbsp;+<br>\n'
 
separator = '&nbsp;+<br>\n'
end
+
elseif animatedIngredients[v] and not animatedIngredients[v].final then
for item in mw.text.gsplit( v, '%s*;%s*' ) do
+
separator = '&nbsp;или'
local parts = getParts( item, args["Мод"] )
 
if parts.name ~= '' and not ingredients[parts.name] and ( k == 2 or k == 1 and v ~= fuel ) then
 
local link = ''
 
if separator == '' and next( ingredients ) then
 
separator = '&nbsp;или<br>\n'
 
end
 
 
if parts.mod then
 
link = parts.mod .. '/' .. parts.name .. '|'
 
end
 
 
if parts.name:find( '^Люб' ) then
 
    if parts.mod then
 
link = parts.mod .. '/' .. mw.ustring.gsub( mw.ustring.sub( parts.name, 7 ), "^%l", mw.ustring.upper ) .. '|'
 
    end
 
table.insert( ingredientsCell, separator .. mw.ustring.sub( parts.name, 0, 6 ) .. '[[' .. link .. mw.ustring.sub( parts.name, 6 ) .. ']]' )
 
else
 
table.insert( ingredientsCell, separator .. '[[' .. link .. parts.name .. ']]' )
 
end
 
separator = ''
 
 
ingredients[parts.name] = 1
 
 
end
 
end
 +
 +
local mod = ( ingredients[v] or animatedIngredients[v] ).mod
 +
local name = ( ingredients[v] or animatedIngredients[v] ).name
 +
table.insert( ingredientsCell, prefixedLink( name, mod ) .. separator )
 
end
 
end
 +
ingredientsCell = table.concat( ingredientsCell, '<br>\n' )
 
end
 
end
+
 
ingredientsCell = table.concat( ingredientsCell )
 
end
 
 
 
-- Остальные аргументы
 
-- Остальные аргументы
 
local newArgs = {
 
local newArgs = {
["Ресурс"] = args[1] or args["Ресурс"],
+
["Ресурс"] = args[1] or args["Ресурс"],
["Выход"] = args[2] or args["Выход"],
+
["Выход"] = args[2] or args["Выход"],
["Топливо"] = fuel,
+
["Топливо"] = fuel,
["РНазв"] = args["рНазв"],
+
["РНазв"] = args["рНазв"],
["ВНазв"] = args["вНазв"],
+
["ВНазв"] = args["вНазв"],
["ТНазв"] = args["тНазв"],
+
["ТНазв"] = args["тНазв"],
["Мод"] = args["Мод"],
+
["Мод"] = args["Мод"],
["Прогресс"] = args["Прогресс"],
+
["Прогресс"] = args["Прогресс"],
["Расход"] = args["Расход"]
+
["Расход"] = args["Расход"]
}
+
}
+
 
 
-- Ячейка с рецептом
 
-- Ячейка с рецептом
 
local recipeCell = require( 'Модуль:Интерфейс' ).furnace( newArgs )
 
local recipeCell = require( 'Модуль:Интерфейс' ).furnace( newArgs )
 
 
 
local row = {
 
local row = {
'|\n' .. ingredientsCell,
+
'|\n' .. ingredientsCell,
'style="padding:1px" |\n' .. recipeCell
+
'style="padding:1px" |\n' .. recipeCell
}
+
}
if nameCell then
+
if nameCell then
table.insert( row, 3, '<b>' .. nameCell .. '</b>' )
+
table.insert( row, 3, '<b>' .. nameCell .. '</b>' )
end
+
end
if f:callParserFunction( '#dplvar', 'smeltingdescription' ) == '1' then
+
if f:callParserFunction( '#dplvar', 'smeltingdescription' ) == '1' then
table.insert( row, args["описание"] or '' )
+
table.insert( row, args["описание"] or '' )
 +
end
 +
row = table.concat( row, '\n|' )
 +
 
 +
local footer = ''
 +
if foot ~= '' then
 +
footer = '|}'
 +
f:callParserFunction( '#dplvar:set', 'smeltingname', '0', 'smeltingdescription', '0' )
 +
end
 +
 
 +
-- Создание различных категорий для DPL
 +
local title = mw.title.getCurrentTitle()
 +
local categories = ''
 +
if args["некат"] ~= '1' and title.namespace == 0 and not title.isSubpage then
 +
categories = {}
 +
 +
if args["запланированное"] then
 +
table.insert( categories, '[[Категория:Запланированные материалы]]' )
 +
end
 +
 +
if args["тип"] then
 +
table.insert( categories, '[[Категория:Рецепты/' .. args["тип"] .. ']]' )
 +
end
 +
 +
if args["игнорировать"] ~= '1' then
 +
local dyes = {
 +
'Оранжевый краситель', 'Сиреневый краситель', 'Светло-синий краситель', 'Жёлтый краситель', 'Лаймовый краситель',
 +
'Розовый краситель', 'Серый краситель', 'Светло-серый краситель', 'Бирюзовый краситель', 'Фиолетовый краситель',
 +
'Лазурит', 'Какао-бобы', 'Кактусовая зелень', 'Красный краситель', 'Чернильный мешок'
 +
}
 +
-- Названия в следующем списке должны писаться ОБЯЗАТЕЛЬНО со строчной буквы, так как встречаются в середине названия:
 +
local variants = {
 +
'древесина', 'доски', 'окрашенное стекло', 'окрашенная стеклянная панель', 'шерсть',
 +
'песчаник', 'ступени', 'плита', 'нажимная пластина', 'звёздочка',
 +
'каменный кирпич', 'андезит', 'диорит', 'гранит', 'щит'
 +
}
 +
 
 +
for k, v in ipairs( ingredientKeys ) do
 +
v = mw.ustring.sub(v, 2 )
 +
if not mw.ustring.find(v, ':' ) then
 +
if v == 'Любой краситель' or v == 'Любой цветной краситель' then
 +
if v == 'Любой краситель' then
 +
table.insert( dyes, 1, 'Костная мука' )
 +
end
 +
else
 +
if v == 'Липкий поршень' then v = 'Поршень'
 +
elseif v == 'Любой гриб' or v == 'Красный гриб' or v == 'Коричневый гриб' then v = 'Гриб'
 +
elseif v == 'Красный песок' then v = 'Песок'
 +
elseif v == 'Древесный уголь' then v = 'Уголь'
 +
elseif mw.ustring.find(v, 'красный песчаник$' ) then v = 'Песчаник'
 +
elseif mw.ustring.find(v, '^Флаг ') or mw.ustring.find(v, ' флаг$') then v = 'Флаг'
 +
elseif v == 'Кварцевый пилон' or v == 'Резной кварцевый блок' then v = 'Кварцевый блок'
 +
else
 +
-- Объединить категории вариантов, описываемых на единой странице
 +
for _, variant in pairs( variants ) do
 +
if mw.ustring.find(v, ' ' .. variant .. '$' ) then
 +
v = variant
 +
break
 +
end
 +
end
 +
 +
-- Убрать приставки
 +
for _, prefix in pairs( prefixes ) do
 +
if mw.ustring.find(v, '^' .. prefix .. ' ' ) then
 +
v = mw.ustring.gsub(v, '^' .. prefix .. ' ', '' )
 +
break
 +
end
 +
end
 +
end
 +
end
 +
end
 +
end
 
end
 
end
row = table.concat( row, '\n|' )
 
 
 
local footer = ''
+
if args["отладка"] == '1' then
if foot ~= '' then
+
return '<pre>' .. header .. '\n' .. row .. '\n|-\n' .. footer .. categories .. '</pre>'
footer = '|}'
+
else
f:callParserFunction( '#dplvar:set', 'smeltingname', '0', 'smeltingdescription', '0' )
+
return header .. '\n' .. row .. '\n|-\n' .. footer .. categories
end
 
 
local title = mw.title.getCurrentTitle()
 
local category = ''
 
if args["запланированное"] and args["некат"] ~= '1' and title.namespace == 0 and not title.isSubpage then
 
category = '[[Категория:Запланированное]]'
 
 
end
 
end
+
end
return header .. '\n' .. row .. '\n|-\n' .. footer .. category
+
 
 +
return header .. '\n' .. row .. '\n|-\n' .. footer .. category
 
end
 
end
 
return p
 
return p

Версия 19:23, 14 октября 2018

Документация

Этот модуль реализует {{обжиг}}.

Зависимости

Смотрите также

Расположенная выше документация включена из Модуль:Обжиг/док.

local p = {}
local slot = require( [[Модуль:Инвентарный слот]] )
local getParts = slot.getParts
local prefixes = slot.prefixes

local function prefixedLink( name, mod )
	local prefix = ''
	for _, thisPrefix in pairs( prefixes ) do
		if mw.ustring.find(name, '^' .. thisPrefix .. ' ' ) then
			prefix = thisPrefix .. ' '
			name = mw.ustring.gsub(name, '^' .. prefix, '' )
			break
		end
	end
	
	local page = ''
	if mod and mod ~= '' then
		page = mod .. '/'
	end

	local vanilla = {v = 1, vanilla = 1, mc = 1, minecraft = 1}
	if mod == '' or vanilla[mw.ustring.lower(parts.mod)] then
		return prefix .. name
	else
		return prefix .. '[[' .. page .. name .. '|' .. name .. ']]'
	end
end

function p.table( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = require( 'Модуль:ProcessArgs' ).merge()
	else
		f = mw.getCurrentFrame()
	end
	
	-- Начинать таблицу при необходимости
	local multirow = f:callParserFunction( '#dplvar', 'multirow' )
	if multirow ~= '1' then
		multirow = nil
	end
	local head = args["глава"] or ''
	if multirow then
		head = ''
		elseif head ~= '' then
			multirow = 1
			f:callParserFunction( '#dplvar:set', 'multirow', '1' )
		else
			head = 1
		end

	-- Заканчивать таблицу при необходимости
	local foot = args["подвал"] or ''
	if multirow then
		if foot ~= '' then
			multirow = nil
			f:callParserFunction( '#dplvar:set', 'multirow', '0' )
		end
	else
		foot = 1
	end
	
	local header = ''
	if head ~= '' then
		local name = ''
		local description = ''
		if args["показатьимя"] == '1' or multirow and args["показатьимя"] ~= '0' then
			name = '!! Результат'
			f:callParserFunction( '#dplvar:set', 'smeltingname', '1' )
		end
		if args["показатьописание"] == '1' then
			description = ' !! class="unsortable" | Описание'
			f:callParserFunction( '#dplvar:set', 'smeltingdescription', '1' )
		end
		local class = args["класс"] or ''
		local recipeClass = ''
		if multirow then
			class = 'sortable collapsible ' .. class
			recipeClass = 'class="unsortable" |'
		end
		local process = ' Процесс'
		if args["Прогресс"] and args["Мод"] then
			process=' Процесс'
		end
		header = table.concat( {
			' {| style="text-align:center" class="wikitable ' .. class .. '" data-description="Процесс"',
			'! ' .. 'Ингредиенты !! ' .. recipeClass .. process  .. name .. description,
			'|-'
			}, '\n' )
	end
	
	local input = mw.text.trim( args[1] or args["Ресурс"] or '' )
	local output = mw.text.trim( args[2] or args["Выход"] or '' )
	local fuel = args["топливо"] or args["Топливо"] or ''
	if fuel == '' and (args["Мод"] == 'IndustrialCraft 2' or 'GregTech' and args['Расход'] == 'Электричество') then
		fuel = 'Энергия'
		elseif fuel == '' then
			fuel = 'v:Любое топливо,1'
		end

	-- Ячейка с названием
	local nameCell
	if f:callParserFunction( '#dplvar', 'craftingname' ) == '1' then
	if args["название"] or '' ~= '' then
		nameCell = args["название"]
	else
		local names = {}
		local links = {}
		for v in mw.text.gsplit( args[2] or args["Выход"] or '', '%s*;%s*' ) do
			parts = getParts( v, args["Мод"] )
			if not names[( parts.mod or '' ) .. parts.name] and output ~= '' then
				table.insert( links, prefixedLink( parts.name, parts.mod ) )
				names[parts.mod .. ':' .. parts.name] = 1
			end
		end
		
		nameCell = table.concat( links, '&nbsp;или<br>' )
	end
end
if nameCell and args["запланированное"] then
	nameCell = nameCell .. '<br>(' .. args["запланированное"] .. ')'
end

	-- Создать список ингредиентов
	local ingredients = {}
	local ingredientKeys = {}
	local animatedIngredients = {}
	local animatedKeys = {}
	for k, v in pairs( args ) do
		v = mw.text.trim( v )
		if v ~= '' and mw.ustring.find(tostring( k ), '^%u?%d%d?$' ) then
			if mw.ustring.find(v, ';' ) then
				table.insert( animatedKeys, v )
			else
				local parts = getParts( v, args["Мод"] )
				parts.mod = parts.mod or ''
				local fullName = parts.mod .. ':' .. parts.name
				if not ingredients[fullName] then
					table.insert( ingredientKeys, fullName )
					ingredients[fullName] = { mod = parts.mod, name = parts.name }
				end
			end
		end
	end
	for k, v in ipairs( animatedKeys ) do
		local frames = mw.text.split( v, '%s*;%s*' )
		local length = #frames
		for k2, v2 in ipairs( frames ) do
			local parts = getParts( v2, args["Мод"] )
			parts.mod = parts.mod or ''
			local fullName = parts.mod .. ':' .. parts.name
			if v2 ~= '' and not ingredients[fullName] and not animatedIngredients[fullName] then
				table.insert( ingredientKeys, fullName )
				animatedIngredients[fullName] = { mod = parts.mod, name = parts.name, final = k2 == length }
			end
		end
	end

	-- Ячейка с ингредиентами
	local ingredientsCell
	if args["ингредиенты"] or '' ~= '' then
		ingredientsCell = args["ингредиенты"]
	else
		ingredientsCell = {}
		for k, v in ipairs{ input, fuel } do
			local separator = '&nbsp;+'
			if k == 2 and next( ingredients ) then
				separator = '&nbsp;+<br>\n'
				elseif animatedIngredients[v] and not animatedIngredients[v].final then
					separator = '&nbsp;или'
				end

				local mod = ( ingredients[v] or animatedIngredients[v] ).mod
				local name = ( ingredients[v] or animatedIngredients[v] ).name
				table.insert( ingredientsCell, prefixedLink( name, mod ) .. separator )
			end
			ingredientsCell = table.concat( ingredientsCell, '<br>\n' )
		end

	-- Остальные аргументы
	local newArgs = {
	["Ресурс"] = args[1] or args["Ресурс"],
	["Выход"] = args[2] or args["Выход"],
	["Топливо"] = fuel,
	["РНазв"] = args["рНазв"],
	["ВНазв"] = args["вНазв"],
	["ТНазв"] = args["тНазв"],
	["Мод"] = args["Мод"],
	["Прогресс"] = args["Прогресс"],
	["Расход"] = args["Расход"]
}

	-- Ячейка с рецептом
	local recipeCell = require( 'Модуль:Интерфейс' ).furnace( newArgs )
	
	local row = {
	'|\n' .. ingredientsCell,
	'style="padding:1px" |\n' .. recipeCell
}
if nameCell then
	table.insert( row, 3, '<b>' .. nameCell .. '</b>' )
end
if f:callParserFunction( '#dplvar', 'smeltingdescription' ) == '1' then
	table.insert( row, args["описание"] or '' )
end
row = table.concat( row, '\n|' )

local footer = ''
if foot ~= '' then
	footer = '|}'
	f:callParserFunction( '#dplvar:set', 'smeltingname', '0', 'smeltingdescription', '0' )
end

	-- Создание различных категорий для DPL
	local title = mw.title.getCurrentTitle()
	local categories = ''
	if args["некат"] ~= '1' and title.namespace == 0 and not title.isSubpage then
		categories = {}
		
		if args["запланированное"] then
			table.insert( categories, '[[Категория:Запланированные материалы]]' )
		end
		
		if args["тип"] then
			table.insert( categories, '[[Категория:Рецепты/' .. args["тип"] .. ']]' )
		end
		
		if args["игнорировать"] ~= '1' then
			local dyes = {
			'Оранжевый краситель', 'Сиреневый краситель', 'Светло-синий краситель', 'Жёлтый краситель', 'Лаймовый краситель',
			'Розовый краситель', 'Серый краситель', 'Светло-серый краситель', 'Бирюзовый краситель', 'Фиолетовый краситель',
			'Лазурит', 'Какао-бобы', 'Кактусовая зелень', 'Красный краситель', 'Чернильный мешок'
		}
			-- Названия в следующем списке должны писаться ОБЯЗАТЕЛЬНО со строчной буквы, так как встречаются в середине названия:
			local variants = {
			'древесина', 'доски', 'окрашенное стекло', 'окрашенная стеклянная панель', 'шерсть',
			'песчаник', 'ступени', 'плита', 'нажимная пластина', 'звёздочка',
			'каменный кирпич', 'андезит', 'диорит', 'гранит', 'щит'
		}

		for k, v in ipairs( ingredientKeys ) do
			v = mw.ustring.sub(v, 2 )
			if not mw.ustring.find(v, ':' ) then
				if v == 'Любой краситель' or v == 'Любой цветной краситель' then
					if v == 'Любой краситель' then
						table.insert( dyes, 1, 'Костная мука' )
					end
				else
					if v == 'Липкий поршень' then v = 'Поршень'
						elseif v == 'Любой гриб' or v == 'Красный гриб' or v == 'Коричневый гриб' then v = 'Гриб'
							elseif v == 'Красный песок' then v = 'Песок'
								elseif v == 'Древесный уголь' then v = 'Уголь'
									elseif mw.ustring.find(v, 'красный песчаник$' ) then v = 'Песчаник'
										elseif mw.ustring.find(v, '^Флаг ') or mw.ustring.find(v, ' флаг$') then v = 'Флаг'
											elseif v == 'Кварцевый пилон' or v == 'Резной кварцевый блок' then v = 'Кварцевый блок'
											else
							-- Объединить категории вариантов, описываемых на единой странице
							for _, variant in pairs( variants ) do
								if mw.ustring.find(v, ' ' .. variant .. '$' ) then
									v = variant
									break
								end
							end
							
							-- Убрать приставки
							for _, prefix in pairs( prefixes ) do
								if mw.ustring.find(v, '^' .. prefix .. ' ' ) then
									v = mw.ustring.gsub(v, '^' .. prefix .. ' ', '' )
									break
								end
							end
						end
					end
			end
		end
	end
	
	if args["отладка"] == '1' then
		return '<pre>' .. header .. '\n' .. row .. '\n|-\n' .. footer .. categories .. '</pre>'
	else
		return header .. '\n' .. row .. '\n|-\n' .. footer .. categories
	end
end

return header .. '\n' .. row .. '\n|-\n' .. footer .. category
end
return p