UWAGA
Strona jest ponownie oddana do uzytku po zabiegach konfiguracyjnych. Jeśli zobaczą Państwo na niej jakieś błedy techniczne, prosimy o ich zgłoszenie.

Większość artykułów w portalu to nasze własne teksty z kluczowych dziedzin związanych z naszą misją. Spora część materiałów pochodzi też z polskiej wersji Wikipedii, gdzie były odrzucone ze względu na politykę redaktorów (przeczytaj o krytyce Wikipedii). Są też i takie, które zostały przeniesione na nasze strony, gdyż stanowią istotne uzupełnienie merytorycznej treści naszego serwisu. Wszystkie artykuły podlegają edycji przez naszych Użytkowników, dlatego ich wersje mogą się różnić od prezentowanych na innych witrynach.

Moduł:Ikona

Z Wedapedia
Przejdź do nawigacji Przejdź do wyszukiwania

Dokumentacja dla tego modułu może zostać utworzona pod nazwą Moduł:Ikona/opis

local data = mw.loadData("Module:Ikona/dane")

return {

plik = function(frame)
	local class
	if type(frame) == "string" then
		class = frame
	else
		class = frame.args[1] or frame:getParent().args[1] or "#default"
	end

	local info = data.icons[mw.ustring.lower(class)] or data.icons["#default"]
	return info.plik
end,

szablon = function(frame)
	-- load arguments
	local pf = frame:getParent()
	local class = pf.args.class or pf.args[1] or "#default"
	local size = pf.args[2] or "#default"
	local link = pf.args.link
	local pos = pf.args["dosuń"]
	local alt = pf.args.alt
	local desc = pf.args.opis
	
	-- render output
	local result = {}
	table.insert(result, "[[Plik:")
	local icon = data.icons[mw.ustring.lower(class)] or data.icons["#default"]
	table.insert(result, icon.plik)
	table.insert(result, "|")
	table.insert(result, data.sizes[size] or data.sizes["#default"])
	table.insert(result, "|class=notpageimage")
	table.insert(result, "|link=")
	if link then
		table.insert(result, link)
	end
	if data.positions[pos] then
		table.insert(result, "|")
		table.insert(result, data.positions[pos])
	end
	table.insert(result, "|alt=")
	if alt then
		table.insert(result, alt)
	end
	if desc then
		table.insert(result, "|")
		table.insert(result, desc)
	end
	table.insert(result, "]]")
	
	return table.concat(result)
end,

doc = function(frame)
	local group = frame.args[1]
	local items = {}
	for k, v in pairs(data.icons) do
		if group and (v.grupa == group) and v.opis and (#v.opis > 0) then
			table.insert(items, { name = k, file = v.plik, doc = v.opis, })
		elseif not group and (not v.opis or (#v.opis == 0)) then
			table.insert(items, { name = k, file = v.plik, })
		end
	end

	if #items <= 0 then
		return
	end
	
	local lang = mw.getContentLanguage()
	local comparison = function(a, b)
		return lang:caseFold((a or {}).name or "") < lang:caseFold((b or {}).name or "")
	end
	table.sort(items, comparison)
	
	local result = {}
	if group and (#group > 0) then
		table.insert(result, "=== ")
		table.insert(result, group)
		table.insert(result, " ===\n")
	end
	
	for _, v in ipairs(items) do
		table.insert(result, "* ")
		table.insert(result, "[[Plik:")
		table.insert(result, v.file)
		table.insert(result, "|20px|link=|alt=|class=notpageimage]]")
		if group then
			table.insert(result, " '''")
			table.insert(result, v.doc)
			table.insert(result, "'''")
		end
		table.insert(result, ": <code>")
		table.insert(result, mw.text.nowiki("{{ikona|"..v.name.."}}"))
		table.insert(result, "</code>\n")
	end
	
	return table.concat(result)
end,

}