Modulis:BioTakso infokaste/Smilšu kaste

Lua kļūda Modulis:Documentation, 388. rinda: message: type error in message cfg.module-sandbox-category (string expected, got nil).

local clasification = {
	{par = "valsts", nos = "[[Valsts (bioloģija)|Valsts]]"},
	{par = "apakšvalsts", nos = "[[Apakšvalsts]]"},
	{par = "nodalījums", nos = "[[Nodalījums (botānika)|Nodalījums]]"},
	{par = "apakšnod", nos = "[[Apakšnodalījums]]"},
	{par = "virstips", nos = "[[Virstips]]"},
	{par = "tips", nos = "[[Tips (zooloģija)|Tips]]"},
	{par = "apakštips", nos = "[[Apakštips]]"},
	{par = "infratips", nos = "[[Infratips]]"},
	{par = "megaklase", nos = "[[Megaklase]]"},
	{par = "virsklase", nos = "[[Virsklase]]"},
	{par = "klase", nos = "[[Klase (bioloģija)|Klase]]"},
	{par = "apakšklase", nos = "[[Apakšklase]]"},
	{par = "infraklase", nos = "[[Infraklase]]"},
	{par = "megakohorta", nos = "[[Megakohorta]]"},
	{par = "virskohorta", nos = "[[Virskohorta]]"},
	{par = "kohorta", nos = "[[Kohorta]]"},
	{par = "apakškohorta", nos = "[[Apakškohorta]]"},
	{par = "infrakohorta", nos = "[[Infrakohorta]]"},
	{par = "sekcija", nos = "[[Sekcija]]"},
	{par = "apakšsekcija", nos = "[[Apakšsekcija]]"},
	{par = "divīzija", nos = "[[Divīzija]]"},
	{par = "apakšdivīzija", nos = "[[Apakšdivīzija]]"},
	{par = "sērija", nos = "[[Sērija]]"},
	{par = "apakšsērija", nos = "[[Apakšsērija]]"},
	{par = "virsrinda", nos = "[[Virsrinda]]"},
	{par = "rinda", nos = "[[Rinda (botānika)|Rinda]]"},
	{par = "apakšrinda", nos = "[[Apakšrinda]]"},
	{par = "augstākā kārta", nos = "[[Augstākā kārta]]"},
	{par = "virskārta", nos = "[[Virskārta]]"},
	{par = "lielkārta", nos = "[[Lielkārta]]"},
	{par = "kārta", nos = "[[Kārta]]"},
	{par = "apakškārta", nos = "[[Apakškārta]]"},
	{par = "infrakārta", nos = "[[Infrakārta]]"},
	{par = "sīkkārta", nos = "[[Sīkkārta]]"},
	{par = "virsdzimta", nos = "[[Virsdzimta]]"},
	{par = "dzimta", nos = "[[Dzimta (bioloģija)|Dzimta]]"},
	{par = "apakšdzimta", nos = "[[Apakšdzimta]]"},
	{par = "cilts", nos = "[[Cilts (bioloģija)|Cilts]]"},
	{par = "virsģints", nos = "[[Virsģints]]"},
	{par = "ģints", nos = "[[Ģints (bioloģija)|Ģints]]"},
	{par = "apakšģints", nos = "[[Apakšģints]]"},
	{par = "suga", nos = "[[Suga]]"},
	{par = "pasuga", nos = "[[Pasuga]]"}
}

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

function p._main(args)
	local out = {}
	local header

	for k,v in ipairs(clasification) do
		local label = v.nos
		
		local nos = args[v.par]
		local nos_lv = args[v.par..'_lv']
		local nos_r = args[v.par..'_r']
		
		local nos2 = args[v.par..'2']
		local nos_lv2 = args[v.par..'_lv2']
		local nos_r2 = args[v.par..'_r2']
		
		if nos or nos_lv then
			out[#out+1] = createRow(label,nos,nos_lv,nos_r)
		end
		
		if nos2 or nos_lv2 then
			out[#out+1] = createRow(label,nos2,nos_lv2,nos_r2)
		end
	end

	for k,v in ipairs(clasification) do
		local nos = args[v.par] or args[v.par..'2']
		local nos_lv = args[v.par..'_lv'] or args[v.par..'_lv2']

		if nos or nos_lv then
			header = createHeader(args.header_background)
			break
		end
	
	end

	return (header or '') .. table.concat(out)
	
end

function createRow(label,nos,nos_lv,nos_r)
	local out = [=[<tr><th scope="row" style="text-align:left;">]=] .. label .. [=[</th><td>]=] .. taksosaite(nos,nos_lv,nos_r) .. [=[</td></tr>]=]

	return out
end

function createHeader(background)
	local background = background
	local out = [=[<tr><th colspan=2 style="text-align:center; font-weight:bold; background-color:#]=] .. background .. [=[;">[[Organismu klasifikācija|Klasifikācija]]</th></tr>]=]

	return out
end

function makeLink(link, text, parenthesis)

	if parenthesis then
		result = "''[[" .. link .. "|" .. text .. "]]''"
	elseif link and text then
		result = "[[" .. link .. "|" .. text .. "]]"
	end
	
	return result
end

function taksosaite(latin,latvian,article)
	local article = article
	local latin = latin
	local latvian = latvian
	
	if article then
		link = article
	elseif latvian then
		link = latvian
	elseif latin then
		link = latin
	end
	
	if latvian then
		text2 = latvian
		parenthesis = false
	elseif latin then
		text2 = latin
		parenthesis = true
	end
	
	result = '<span style="font-weight:bold;">' .. makeLink(link,text2,parenthesis) .. '</span>'
	
	if latin and latvian then
		result = result .. " (''" .. latin .. "'')"
	end
	
	return result
end

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

return p