Module:CraftingTable: Difference between revisions

From Ylvapedia
mNo edit summary
No edit summary
(9 intermediate revisions by the same user not shown)
Line 6: Line 6:
local lang = f.args[1]
local lang = f.args[1]
local data = mw.loadData('Module:CraftingTable/i18n')
local data = mw.loadData('Module:CraftingTable/i18n')
local title = mw.title.getCurrentTitle()
local Recipe = {
{
CraftingStation = args[data[lang]['CraftingStation']] or '',
Ingredient = args[data[lang]['Ingredient']] or '',
IngredientNum = args[data[lang]['IngredientNum']] or '',
IngredientExtra = args[data[lang]['IngredientExtra']] or '',
CraftResult = args[data[lang]['TitleResult']] or '',
},
{
CraftingStation = args[data[lang]['CraftingStation']..'2'] or '',
Ingredient = args[data[lang]['Ingredient']..'2'] or '',
IngredientNum = args[data[lang]['IngredientNum']..'2'] or '',
IngredientExtra = args[data[lang]['IngredientExtra']..'2'] or '',
CraftResult = args[data[lang]['TitleResult']..'2'] or '',
},
{
CraftingStation = args[data[lang]['CraftingStation']..'3'] or '',
Ingredient = args[data[lang]['Ingredient']..'3'] or '',
IngredientNum = args[data[lang]['IngredientNum']..'3'] or '',
IngredientExtra = args[data[lang]['IngredientExtra']..'3'] or '',
CraftResult = args[data[lang]['TitleResult']..'3'] or '',
}
}


--Recipe1
local CSs = { '', '', '' }
local CSs = ''
local CSCategory = ''
if not args[data[lang]['CraftingStation']] then
local Ings = { '', '', '' }
error( data[lang]['ErrorCraftingStation'] )
local Results = { '', '', '' }
else
 
f:callParserFunction( '#Set', 'CraftingStation', args[data[lang]['CraftingStation']] )
for n = 1, 3 ,1 do
local v = {} ; v = mw.text.split(args[data[lang]['CraftingStation']], "%s*,%s*")
for i, item in ipairs(v) do
if i > 1 then CSs = CSs .. '<br />' end
if item ~= '' then
CSs = CSs .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item } }
else
CSs = CSs .. data[lang]['BlankValue']
end
end
end


local Ings = ''
if not Recipe[n].CraftingStation or Recipe[n].CraftingStation == '' then
if not args[data[lang]['Ingredient']] then
if n == 1 then CSs[1] = data[lang]['ErrorCraftingStation'] end
error( data[lang]['ErrorIngredient'] )
else
f:callParserFunction( '#Set', 'Ingredient', args[data[lang]['Ingredient']] )
local v = {} ; v = mw.text.split(args[data[lang]['Ingredient']], "%s*,%s*")
if not args[data[lang]['IngredientNum']] then
error( data[lang]['ErrorIngredientNum'] )
else
else
f:callParserFunction( '#Set', 'IngredientNum', args[data[lang]['IngredientNum']] )
local v = {} ; v = mw.text.split(Recipe[n].CraftingStation, "%s*,%s*")
local x = {} ; x = mw.text.split(args[data[lang]['IngredientNum']], "%s*,%s*")
f:callParserFunction( '#Set', 'CraftingStation', Recipe[n].CraftingStation )
local y = {}
local check
if args[data[lang]['IngredientExtra']] then
f:callParserFunction( '#Set', 'IngredientExtra', args[data[lang]['IngredientExtra']] )
y = mw.text.split(args[data[lang]['IngredientExtra']], "%s*,%s*")
end
for i, item in ipairs(v) do
for i, item in ipairs(v) do
if i > 1 and check == false then Ings = Ings .. '<br />' end
 
check = false
if i > 1 then CSs[n] = CSs[n] .. '<br />' end
if item ~= '' then
 
local z = string.find(item, "%s*/%s*")
if not item or item == '' then
if z then
CSs[n] = CSs[n] .. data[lang]['BlankValue']
local z = {} ; z = mw.text.split(item, "%s*/%s*")
else
local z2 = {} ; z2 = mw.text.split(x[i], "%s*/%s*") or 1
CSs[n] = CSs[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item,size=imgsize } }
for i2, item2 in ipairs(z) do
if title.nsText == "Elin" then
if i2 > 1 then Ings = Ings .. '<div class="or-separator">or</div>' end
CSCategory = CSCategory..'[[Category:Elin '..item..']]'
Ings = Ings .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item2,z2[i2] } }
end
Ings = Ings .. '<div class="separator">&nbsp;</div>'
check = true
else
Ings = Ings .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item,x[i] } }
end
if y[i] == data[lang]['TitleExtra'] then
Ings = Ings .. data[lang]['TextExtra']
elseif y[i] == data[lang]['TitleGourmet'] then
Ings = Ings .. data[lang]['TextGourmet']
end
end
else
Ings = Ings .. data[lang]['BlankValue']
end
end
end
end
end
end
end
--Recipe2
local CSs2 = ''
if not args[data[lang]['CraftingStation']..'2'] then
else
f:callParserFunction( '#Set', 'CraftingStation2', args[data[lang]['CraftingStation']..'2'] )
local v = {} ; v = mw.text.split(args[data[lang]['CraftingStation']..'2'], "%s*,%s*")
for i, item in ipairs(v) do
if i > 1 then CSs2 = CSs2 .. '<br />' end
if item ~= '' then
CSs2 = CSs2 .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item } }
else
CSs2 = CSs2 .. data[lang]['BlankValue']
end
end
end


local Ings2 = ''
if not Recipe[n].Ingredient or Recipe[n].Ingredient == '' then
if not args[data[lang]['Ingredient']..'2'] then
if n == 1 then Ings[1] = data[lang]['ErrorIngredient'] end
else
f:callParserFunction( '#Set', 'Ingredient2', args[data[lang]['Ingredient']..'2'] )
local v = {} ; v = mw.text.split(args[data[lang]['Ingredient']..'2'], "%s*,%s*")
if not args[data[lang]['IngredientNum']..'2'] then
else
else
f:callParserFunction( '#Set', 'IngredientNum2', args[data[lang]['IngredientNum']..'2'] )
local v = {} ; v = mw.text.split(Recipe[n].Ingredient, "%s*,%s*")
local x = {} ; x = mw.text.split(args[data[lang]['IngredientNum']..'2'], "%s*,%s*")
local x = {} ; x = mw.text.split(Recipe[n].IngredientNum, "%s*,%s*")
local y = {}
local y = {} ; y = mw.text.split(Recipe[n].IngredientExtra, "%s*,%s*")
local check
f:callParserFunction( '#Set', 'Ingredient', Recipe[n].Ingredient )
if args[data[lang]['IngredientExtra']..'2'] then
f:callParserFunction( '#Set', 'IngredientNum', Recipe[n].IngredientNum )
f:callParserFunction( '#Set', 'IngredientExtra2', args[data[lang]['IngredientExtra']..'2'] )
f:callParserFunction( '#Set', 'IngredientExtra', Recipe[n].IngredientExtra )
y = mw.text.split(args[data[lang]['IngredientExtra']..'2'], "%s*,%s*")
end
for i, item in ipairs(v) do
for i, item in ipairs(v) do
if i > 1 and check == false then Ings2 = Ings2 .. '<br />' end
 
check = false
if i > 1 then
if item ~= '' then
Ings[n] = Ings[n] .. '<div class="plus or-separator">&plus;</div>'
local z = string.find(item, "%s*/%s*")
end
 
if not item or item == '' then
Ings[n] = Ings[n] .. data[lang]['BlankValue']
else
local z = string.find(item, "/")
if z then
if z then
local z = {} ; z = mw.text.split(item, "%s*/%s*")
local z = {} ; z = mw.text.split(item, "%s*/%s*")
local z2 = {} ; z2 = mw.text.split(x[i], "%s*/%s*") or 1
local z2 = {} ; z2 = mw.text.split(x[i], "%s*/%s*") or 1
local z3 = {} ; z3 = mw.text.split(y[i], "%s*/%s*") or ''
for i2, item2 in ipairs(z) do
for i2, item2 in ipairs(z) do
if i2 > 1 then Ings2 = Ings2 .. '<div class="or-separator">or</div>' end
if i2 > 1 then
Ings2 = Ings2 .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item2,z2[i2] } }
Ings[n] = Ings[n] .. '<div class="or-separator">'..data[lang]['Or']..'</div>'
end
if z2[i2] == '' then
Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item2,size=imgsize } }
else
Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item2,z2[i2],size=imgsize } }
end
 
if z3[i2] == data[lang]['TitleExtra'] then
Ings[n] = Ings[n] .. data[lang]['TextExtra']
elseif z3[i2] ==  data[lang]['TitleGourmet'] then
Ings[n] = Ings[n] .. data[lang]['TextGourmet']
end
end
end
Ings2 = Ings2 .. '<div class="separator">&nbsp;</div>'
check = true
else
else
Ings2 = Ings2 .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item,x[i] } }
local v2 = string.find(item, "@")
end
if v2 then
local v2 = {} ; v2 = mw.text.split(item, "%s*@%s*")
if y[i] == data[lang]['TitleExtra'] then
Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { v2[1],v=v2[2],size=imgsize } }
Ings2 = Ings2 .. data[lang]['TextExtra']
else
elseif y[i] == data[lang]['TitleGourmet'] then
if x[i] == '' then
Ings2 = Ings2 .. data[lang]['TextGourmet']
Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item,size=imgsize } }
else
Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item,x[i],size=imgsize } }
end
end
 
if y[i] == data[lang]['TitleExtra'] then
Ings[n] = Ings[n] .. data[lang]['TextExtra']
elseif y[i] == data[lang]['TitleGourmet'] then
Ings[n] = Ings[n] .. data[lang]['TextGourmet']
end
end
end
else
Ings2 = Ings2 .. data[lang]['BlankValue']
end
end
end
end
end
end
end
--Recipe3
local CSs3 = ''
if not args[data[lang]['CraftingStation']..'3'] then
else
f:callParserFunction( '#Set', 'CraftingStation3', args[data[lang]['CraftingStation']..'3'] )
local v = {} ; v = mw.text.split(args[data[lang]['CraftingStation']..'3'], "%s*,%s*")
for i, item in ipairs(v) do
if i > 1 then CSs3 = CSs3 .. '<br />' end
if item ~= '' then
CSs3 = CSs3 .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item } }
else
CSs3 = CSs3 .. data[lang]['BlankValue']
end
end
end


local Ings3 = ''
if not Recipe[n].CraftResult or Recipe[n].CraftResult == '' then
if not args[data[lang]['Ingredient']..'3'] then
else
f:callParserFunction( '#Set', 'Ingredient3', args[data[lang]['Ingredient']..'3'] )
local v = {} ; v = mw.text.split(args[data[lang]['Ingredient']..'3'], "%s*,%s*")
if not args[data[lang]['IngredientNum']..'3'] then
else
else
f:callParserFunction( '#Set', 'IngredientNum3', args[data[lang]['IngredientNum']..'3'] )
z = string.find(Recipe[n].CraftResult, "%s*/%s*")
local x = {} ; x = mw.text.split(args[data[lang]['IngredientNum']..'3'], "%s*,%s*")
f:callParserFunction( '#Set', 'CraftingResult', Recipe[n].CraftResult )
local y = {}
if z then
local check
local x = {} ; x = mw.text.split(Recipe[n].CraftResult, "%s*/%s*")
if args[data[lang]['IngredientExtra']..'3'] then
local x2 = string.find(Recipe[n].CraftResult, "@")
f:callParserFunction( '#Set', 'IngredientExtra3', args[data[lang]['IngredientExtra']..'3'] )
if x2 then
y = mw.text.split(args[data[lang]['IngredientExtra']..'3'], "%s*,%s*")
local x2 = {} ; x2 = mw.text.split(x[1], "%s*@%s*")
end
Results[n] = f:expandTemplate{ title = data[lang]['TemplateName'], args = { x2[1],x[2],v=x2[2],link='Elin:'..x2[1]..' '..x2[2],size=imgsize } }
for i, item in ipairs(v) do
else
if i > 1 and check == false then Ings3 = Ings3 .. '<br />' end
Results[n] = f:expandTemplate{ title = data[lang]['TemplateName'], args = { x[1],x[2],size=imgsize } }
check = false
end
if item ~= '' then
else
local z = string.find(item, "%s*/%s*")
local x = string.find(Recipe[n].CraftResult, "@")
if z then
if x then
local z = {} ; z = mw.text.split(item, "%s*/%s*")
local x = {} ; x = mw.text.split(Recipe[n].CraftResult, "%s*@%s*")
local z2 = {} ; z2 = mw.text.split(x[i], "%s*/%s*") or 1
Results[n] = f:expandTemplate{ title = data[lang]['TemplateName'], args = { x[1],v=x[2],link='Elin:'..x[1]..' '..x[2],size=imgsize } }
for i2, item2 in ipairs(z) do
if i2 > 1 then Ings3 = Ings3 .. '<div class="or-separator">or</div>' end
Ings3 = Ings3 .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item2,z2[i2] } }
end
Ings3 = Ings3 .. '<div class="separator">&nbsp;</div>'
check = true
else
Ings3 = Ings3 .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item,x[i] } }
end
if y[i] == data[lang]['TitleExtra'] then
Ings3 = Ings3 .. data[lang]['TextExtra']
elseif y[i] == data[lang]['TitleGourmet'] then
Ings3 = Ings3 .. data[lang]['TextGourmet']
end
else
else
Ings2 = Ings3 .. data[lang]['BlankValue']
Results[n] = f:expandTemplate{ title = data[lang]['TemplateName'], args = { Recipe[n].CraftResult,size=imgsize } }
end
end
end
end
end
end
end
end


local Craftingskill = args[data[lang]['CraftSkill']] or nil
local Craftingskill = args[data[lang]['CraftSkill']] or nil
Line 217: Line 172:
end
end


table:tag('tr'):tag('th'):attr('colspan',2):wikitext(Skills)
if Results ~= '' then colspan = 3
else colspan = 2 end
table:tag('tr'):tag('th'):attr('colspan',colspan):wikitext(Skills)
end
end
table:tag('tr'):tag('th'):wikitext(string.format(data[lang]['TitleCraftingStation'])):tag('th'):wikitext(string.format(data[lang]['TitleIngredient']))
:tag('tr'):tag('td'):wikitext(CSs):tag('td'):wikitext(Ings)


if Ings2 ~= '' then
for n = 1, 3 ,1 do
local table2 = div:tag('table'):addClass('wikitable'):cssText('margin-left:1em;')
if CSs[n] ~= '' or Ings[n] ~= '' or Results[n] ~= '' then
table2:tag('tr'):tag('th'):wikitext(string.format(data[lang]['TitleCraftingStation'])):tag('th'):wikitext(string.format(data[lang]['TitleIngredient']))
if n > 1 then
:tag('tr'):tag('td'):wikitext(CSs2):tag('td'):wikitext(Ings2)
table = div:tag('table'):addClass('wikitable'):cssText('margin-left:1em;')
end
local tr1 = table:tag('tr')
tr1:tag('th'):wikitext(data[lang]['TitleCraftingStation'])
tr1:tag('th'):wikitext(data[lang]['TitleIngredient'])
if Results[n] ~= '' then
tr1:tag('th'):wikitext(data[lang]['TitleResult'])
end
local tr2 = table:tag('tr')
tr2:tag('td'):wikitext(CSs[n])
tr2:tag('td'):cssText('text-align: center;'):wikitext(Ings[n])
if Results[n] ~= '' then
tr2:tag('td'):cssText('text-align: center;'):wikitext(Results[n])
end
end
end
end


if Ings3 ~= '' then
html:wikitext(string.format('<div style="clear:both;"></div>'))
local table3 = div:tag('table'):addClass('wikitable'):cssText('margin-left:1em;')
 
table3:tag('tr'):tag('th'):wikitext(string.format(data[lang]['TitleCraftingStation'])):tag('th'):wikitext(string.format(data[lang]['TitleIngredient']))
local CraftBonus = args[data[lang]['CraftBonus']] or nil
:tag('tr'):tag('td'):wikitext(CSs3):tag('td'):wikitext(Ings3)
if not CraftBonus or CraftBonus == '' then
else
html:tag('li'):wikitext(string.format('<b>'.. data[lang]['TitleCraftBonus'] ..'</b> : ' .. CraftBonus)):done()
f:callParserFunction( '#Set', 'CraftBonus', CraftBonus )
end
end
html:wikitext(string.format('<div style="clear:both;"></div>'))


local ObtainRecipe = args[data[lang]['ObtainRecipe']] or nil
local ObtainRecipe = args[data[lang]['ObtainRecipe']] or nil
if not ObtainRecipe then
if not ObtainRecipe or ObtainRecipe == '' then
else
else
html:wikitext(string.format('<h3>'.. data[lang]['TitleObtainRecipe'] ..'</h3>' .. ObtainRecipe))
html:tag('li'):wikitext(string.format('<b>'.. data[lang]['TitleObtainRecipe'] ..'</b> : ' .. ObtainRecipe)):done()
f:callParserFunction( '#Set', 'ObtainRecipe', ObtainRecipe )
f:callParserFunction( '#Set', 'ObtainRecipe', ObtainRecipe )
end
end


local title = mw.title.getCurrentTitle()
if title.nsText == "Elin" then
if title.nsText == "Elin" then
html:wikitext(string.format(data[lang]['Category']))
html:wikitext(string.format(data[lang]['Category']))
end
if not CSCategory or CSCategory == '' then
else
html:wikitext(CSCategory)
end
end



Revision as of 14:57, 23 March 2025

Documentation for this module may be created at Module:CraftingTable/doc

local p = {}

function p.crafttable(f)

	local args = f:getParent().args
	local lang = f.args[1]
	local data = mw.loadData('Module:CraftingTable/i18n')
	local title = mw.title.getCurrentTitle()
	local Recipe = {
		{
			CraftingStation = args[data[lang]['CraftingStation']] or '',
			Ingredient = args[data[lang]['Ingredient']] or '',
			IngredientNum = args[data[lang]['IngredientNum']] or '',
			IngredientExtra = args[data[lang]['IngredientExtra']] or '',
			CraftResult = args[data[lang]['TitleResult']] or '',
		},
		{
			CraftingStation = args[data[lang]['CraftingStation']..'2'] or '',
			Ingredient = args[data[lang]['Ingredient']..'2'] or '',
			IngredientNum = args[data[lang]['IngredientNum']..'2'] or '',
			IngredientExtra = args[data[lang]['IngredientExtra']..'2'] or '',
			CraftResult = args[data[lang]['TitleResult']..'2'] or '',
		},
		{
			CraftingStation = args[data[lang]['CraftingStation']..'3'] or '',
			Ingredient = args[data[lang]['Ingredient']..'3'] or '',
			IngredientNum = args[data[lang]['IngredientNum']..'3'] or '',
			IngredientExtra = args[data[lang]['IngredientExtra']..'3'] or '',
			CraftResult = args[data[lang]['TitleResult']..'3'] or '',
		}
	}

	local CSs = { '', '', '' }
	local CSCategory = ''
	local Ings = { '', '', '' }
	local Results = { '', '', '' }

	for n = 1, 3 ,1 do

		if not Recipe[n].CraftingStation or Recipe[n].CraftingStation == '' then
			if n == 1 then CSs[1] = data[lang]['ErrorCraftingStation'] end
		else
			local v = {} ; v = mw.text.split(Recipe[n].CraftingStation, "%s*,%s*")
			f:callParserFunction( '#Set', 'CraftingStation', Recipe[n].CraftingStation )
			for i, item in ipairs(v) do

				if i > 1 then CSs[n] = CSs[n] .. '<br />' end

				if not item or item == '' then
					CSs[n] = CSs[n] .. data[lang]['BlankValue']
				else
					CSs[n] = CSs[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item,size=imgsize } }
					if title.nsText == "Elin" then
						CSCategory = CSCategory..'[[Category:Elin '..item..']]'
					end
				end
			end
		end

		if not Recipe[n].Ingredient or Recipe[n].Ingredient == '' then
			if n == 1 then Ings[1] = data[lang]['ErrorIngredient'] end
		else
			local v = {} ; v = mw.text.split(Recipe[n].Ingredient, "%s*,%s*")
			local x = {} ; x = mw.text.split(Recipe[n].IngredientNum, "%s*,%s*")
			local y = {} ; y = mw.text.split(Recipe[n].IngredientExtra, "%s*,%s*")
			f:callParserFunction( '#Set', 'Ingredient', Recipe[n].Ingredient )
			f:callParserFunction( '#Set', 'IngredientNum', Recipe[n].IngredientNum )
			f:callParserFunction( '#Set', 'IngredientExtra', Recipe[n].IngredientExtra )
			for i, item in ipairs(v) do

				if i > 1 then
					Ings[n] = Ings[n] .. '<div class="plus or-separator">&plus;</div>'
				end

				if not item or item == '' then
					Ings[n] = Ings[n] .. data[lang]['BlankValue']
				else
					local z = string.find(item, "/")
					if z then
						local z = {} ; z = mw.text.split(item, "%s*/%s*")
						local z2 = {} ; z2 = mw.text.split(x[i], "%s*/%s*") or 1
						local z3 = {} ; z3 = mw.text.split(y[i], "%s*/%s*") or ''
						for i2, item2 in ipairs(z) do
							if i2 > 1 then
								Ings[n] = Ings[n] .. '<div class="or-separator">'..data[lang]['Or']..'</div>'
							end
							if z2[i2] == '' then
								Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item2,size=imgsize } }
							else
								Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item2,z2[i2],size=imgsize } }
							end

							if z3[i2] == data[lang]['TitleExtra'] then
								Ings[n] = Ings[n] .. data[lang]['TextExtra']
							elseif z3[i2] ==  data[lang]['TitleGourmet'] then
								Ings[n] = Ings[n] .. data[lang]['TextGourmet']
							end
						end
					else
						local v2 = string.find(item, "@")
						if v2 then
							local v2 = {} ; v2 = mw.text.split(item, "%s*@%s*")
							Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { v2[1],v=v2[2],size=imgsize } }
						else
							if x[i] == '' then
								Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item,size=imgsize } }
							else
								Ings[n] = Ings[n] .. f:expandTemplate{ title = data[lang]['TemplateName'], args = { item,x[i],size=imgsize } }
							end
						end

						if y[i] == data[lang]['TitleExtra'] then
							Ings[n] = Ings[n] .. data[lang]['TextExtra']
						elseif y[i] ==  data[lang]['TitleGourmet'] then
							Ings[n] = Ings[n] .. data[lang]['TextGourmet']
						end
					end
				end
			end
		end

		if not Recipe[n].CraftResult or Recipe[n].CraftResult == '' then
		else
			z = string.find(Recipe[n].CraftResult, "%s*/%s*")
			f:callParserFunction( '#Set', 'CraftingResult', Recipe[n].CraftResult )
			if z then
				local x = {} ; x = mw.text.split(Recipe[n].CraftResult, "%s*/%s*")
				local x2 = string.find(Recipe[n].CraftResult, "@")
				if x2 then
					local x2 = {} ; x2 = mw.text.split(x[1], "%s*@%s*")
					Results[n] = f:expandTemplate{ title = data[lang]['TemplateName'], args = { x2[1],x[2],v=x2[2],link='Elin:'..x2[1]..' '..x2[2],size=imgsize } }
				else
					Results[n] = f:expandTemplate{ title = data[lang]['TemplateName'], args = { x[1],x[2],size=imgsize } }
				end
			else
				local x = string.find(Recipe[n].CraftResult, "@")
				if x then
					local x = {} ; x = mw.text.split(Recipe[n].CraftResult, "%s*@%s*")
					Results[n] = f:expandTemplate{ title = data[lang]['TemplateName'], args = { x[1],v=x[2],link='Elin:'..x[1]..' '..x[2],size=imgsize } }
				else
					Results[n] = f:expandTemplate{ title = data[lang]['TemplateName'], args = { Recipe[n].CraftResult,size=imgsize } }
				end
			end
		end
	end


	local Craftingskill = args[data[lang]['CraftSkill']] or nil
	local CraftingskillLv = args[data[lang]['CraftSkillLv']] or nil

	local html = mw.html.create('p')
	local div = html:tag('div'):addClass('CraftingTable'):cssText('float: left; display: ruby;')
	local table = div:tag('table'):addClass('wikitable')
		if not Craftingskill and not CraftingskillLv then
		else
			local Skills = ''

			if not Craftingskill then
				Skills = '?'..data[lang]['TitleSkill']
			else
				Skills = Craftingskill..data[lang]['TitleSkill']
				f:callParserFunction( '#Set', 'CraftingSkill', Craftingskill )
			end

			Skills = Skills .. '&nbsp;'

			if not CraftingskillLv then
				Skills = Skills .. 'Lv.?'
			else
				Skills = Skills .. 'Lv.'.. CraftingskillLv
				f:callParserFunction( '#Set', 'CraftingSkillLv', CraftingskillLv )
			end

			if Results ~= '' then colspan = 3
			else colspan = 2 end
			table:tag('tr'):tag('th'):attr('colspan',colspan):wikitext(Skills)
		end

		for n = 1, 3 ,1 do
			if CSs[n] ~= '' or Ings[n] ~= '' or Results[n] ~= '' then
				if n > 1 then
					table = div:tag('table'):addClass('wikitable'):cssText('margin-left:1em;')
				end
				local tr1 = table:tag('tr')
				tr1:tag('th'):wikitext(data[lang]['TitleCraftingStation'])
				tr1:tag('th'):wikitext(data[lang]['TitleIngredient'])
				if Results[n] ~= '' then
					tr1:tag('th'):wikitext(data[lang]['TitleResult'])
				end
				local tr2 = table:tag('tr')
				tr2:tag('td'):wikitext(CSs[n])
				tr2:tag('td'):cssText('text-align: center;'):wikitext(Ings[n])
				if Results[n] ~= '' then
					tr2:tag('td'):cssText('text-align: center;'):wikitext(Results[n])
				end
			end
		end

		html:wikitext(string.format('<div style="clear:both;"></div>'))

		local CraftBonus = args[data[lang]['CraftBonus']] or nil
		if not CraftBonus or CraftBonus == '' then
		else
			html:tag('li'):wikitext(string.format('<b>'.. data[lang]['TitleCraftBonus'] ..'</b> : ' .. CraftBonus)):done()
			f:callParserFunction( '#Set', 'CraftBonus', CraftBonus )
		end

		local ObtainRecipe = args[data[lang]['ObtainRecipe']] or nil
		if not ObtainRecipe or ObtainRecipe == '' then
		else
			html:tag('li'):wikitext(string.format('<b>'.. data[lang]['TitleObtainRecipe'] ..'</b> : ' .. ObtainRecipe)):done()
			f:callParserFunction( '#Set', 'ObtainRecipe', ObtainRecipe )
		end

		if title.nsText == "Elin" then
			html:wikitext(string.format(data[lang]['Category']))
		end

		if not CSCategory or CSCategory == '' then
		else
			html:wikitext(CSCategory)
		end

	return tostring(html)
	
end

return p