For faster navigation, this Iframe is preloading the Wikiwand page for Moduł:Klad.

Moduł:Klad

 Dokumentacja modułu [stwórz] [odśwież]
function loadTree(data)
	local tree = {}
	
	for k, v in pairs(data) do
		if v and (#v > 0) then
			local keys = mw.text.split(k,'.',true)
			local index = keys[#keys]
			if #keys > 1 then
				for i = 1, #keys-1 do
					keys[i] = tonumber(string.match(keys[i], "^[0-9][0-9]?$"))
					if not keys[i] or (keys[i] == 0) then
						index = false
						break
					end
				end
			end
			
			if index then
				local node = tree
				for i = 1, #keys-1 do
					local k = keys[i]
					local child = node[k]
					if not child then
						child = {}
						node[k] = child
					elseif type(child) == "string" then
						local labelName = "label"..k
						if not node[labelName] then
							node[labelName] = child
						end
						
						child = {}
						node[k] = child
					end
					
					node = child
				end
				
				local childIndex = tonumber(index)
				if childIndex then
					if type(node[childIndex]) == "table" then
						local labelName = "label"..index
						if not node[labelName] then
							node[labelName] = v
						end
					else
						node[childIndex] = v
					end
				else
					node[index] = v
				end
			end
		end
	end
	
	return tree
end

function printTree(tree)
	local result = {}
	local style = tree.style or ""
	table.insert(result, '{| cellspacing=0 cellpadding=0 border=0 style="'..style..'"\n')
	local thickness = tostring(tonumber(tree.thickness) or 1)
	for i, v in ipairs(tree) do
		local text
		local labelName = "label"..tostring(i)
		local label = tree[labelName] or "<br />"
		if type(v) == "string" then
			-- Czy klad zagnieżdżony (v jest tabelą)
			if string.sub(mw.text.trim(v),1,2) == '{|' then
				--mw.log('\nt '..v..'\n')
				text = v
			else
				--mw.log('\n! '..v..'\n')
				text = '<span style="margin-left:5px;">'..v..'</span>'
			end
		elseif type(v) == "table" then
			text = printTree(v)
		end

		if i == 1 then
			table.insert(result, '| style="width:1.5em;border-bottom:'..thickness..'px solid black; padding:0px 5px 0px 5px;" valign=bottom align=center | '..label..' || rowspan=2 |\n')
			table.insert(result, text or "(({1))}")
			table.insert(result, '\n|-\n')
		elseif text and #text > 0 then
			table.insert(result, '| style="border-left:'..thickness..'px solid black;" valign=top |<br/>\n')
			table.insert(result, '|-\n')
			table.insert(result, '| style="border-left:'..thickness..'px solid black; border-bottom:'..thickness..'px solid black; padding:0px 5px 0px 5px;" valign=bottom align=center | '..label..' || rowspan=2 |\n')
			table.insert(result, text)
			table.insert(result, '\n|-\n')
		end
	end
	
	table.insert(result, '| valign=top | <br/>\n')
	table.insert(result, '|}')
	return table.concat(result)
end


return {
	
["Pokaż"] = function(frame)
	local tree = loadTree(frame:getParent().args)
	if tree and (#tree > 0) then
		return printTree(tree)
	end
end

}
{{bottomLinkPreText}} {{bottomLinkText}}
Moduł:Klad
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?