FANDOM


--<source lang="lua">
--=IESW.main({args={'Test','Test',s='Test'}})
IESW={}
 
local data=mw.loadData('Moduł:IESW/data')
local title=mw.title.getCurrentTitle()
local title2=mw.title.new(title.text)
local title3=tostring(title)
 
function IESW.main(frame)
	local infobox=mw.html.create('infobox')
	local group=mw.html.create('group')
	local name=mw.html.create('title')
	local default=mw.html.create('default')
	local navigation=mw.html.create('navigation')
	local nav=mw.html.create('navigation')
	local mapa=mw.html.create('group')
	local sound=mw.html.create('navigation')
	local links=mw.html.create('div')
	local e,gr,ob,ma,t,c,v,w='','','','','','','',''
	local y,o,g,h,z,u,l,m={},{},{},{},{},{},{},{}
 
	mapa:tag('header'):wikitext('Mapa')
 
	for i,x in pairs(frame.args) do
		u=mw.text.split(i,':')
		o[tonumber(u[1])]=i
		g[tonumber(u[1])]=x
		for j=1, #w do
			w[j]=mw.text.trim(w[j])
		end
	end
 
	for i,_ in ipairs(g) do
		h=y
		y=mw.text.split(o[i],':')
		m[i]={'',''}
		m[i]=mw.text.split(g[i],'%~')
		l[i]={'',''}
		l[i]=mw.text.split(m[i][1],'@%^')
		g[i]=l[i][1]
 
		if h[3] ~= y[3] and is(y[3]) then
			group:tag('header'):wikitext(y[3])
 
			if not is(y[4]) then y[4]='' end
			group:attr('collapse',y[4])
 
			if is(y[6]) then
				group:attr('layout',y[6])
			end
 
			if is(y[7]) then
				group:attr('show',y[7])
			end
		end
 
		if is(g[i]) then
			if y[2] == 'Ikona' then
				default:wikitext('<div class="pi-icon">[[Plik:'..g[i]..'|32px|right]]</div>')
			elseif y[2] == 'Nazwa' then
				name:attr('source',y[2])
				default:wikitext('<div class="pi-title-icon">'..g[i]..'</div>')
			elseif y[2] == 'Podtytuł' then
				default:wikitext('<div class="pi-subtitle">'..g[i]..'</div>')
			elseif y[2] == 'Nawigacja' then
				navi='<div class="pi-change">{{#vardefine:s|0}}{{#arraydefine:!!|{{#loop:p|0|8|{{#explode:{{#arraydefine:##|'..g[i]..'}}{{#arrayprint:##|$,|^^|^^}}|$|{{#var:p}}}}}}}}{{#arrayprint:!!|&nbsp;&bull;&nbsp;|§|<span class="changebox ESWhover" id="switch{{#var:s}}{{#vardefine:s|{{#expr:{{#var:s}}+1}}}}">§</span>}}</div>'
				navigation:wikitext(navi):done()
			elseif y[2] == 'Plik' then
				file=mw.html.create('image')
				file
					:attr('source',y[2])
					:tag('default')
					:wikitext(IESWFile(g[i]:gsub('Plik:',''),'',w[j]))
			elseif y[2] == 'Podpis pliku' and is(file) then
				file
					:tag('alt')
					:attr('source',y[2])
					:wikitext('<default>'..g[i]..'</default>')
				file
					:tag('caption')
					:attr('source',y[2])
					:wikitext('<default>'..g[i]..'</default>')
			elseif y[2] == 'Mapa' then
				map=mw.html.create('image')
				map
					:attr('source',y[2])
					:tag('default')
					:wikitext(IESWFile(g[i]:gsub('Plik:',''),'_(mapa)',w[j]))
			elseif y[2] == 'Podpis mapy' and is(map) then
				map
					:tag('alt')
					:attr('source',y[2])
					:wikitext('<default>'..g[i]..'</default>')
				map
					:tag('caption')
					:attr('source',y[2])
					:wikitext('<default>'..g[i]..'</default>')
			elseif y[2] == 'nav' then
				group:tag('navigation'):wikitext(g[i]):done()
			elseif y[2] == 'link' then
				group:tag('navigation'):wikitext('['..g[i]..' Oficjalna strona internetowa]'):done()
			elseif y[2] == 'szablon' then
				t=g[i]
			elseif y[2] == 'kategoria' then
				c=g[i]
			elseif y[2] == 'motyw' then
				infobox:attr('theme',g[i]:gsub('%[+(.-)%]+','%1'))
			else
--56:Szczęście:Atrybuty:closed:l:horizontal:incomplete:cat:unique:sort:sep:none
--(frame.args.s,frame.args[1],frame.args[2],frame.args.u,frame.args.sort,frame.args.r,frame.args.cat,frame.args.none)
				group:wikitext('<data source="'..y[2]..'"><label>'..y[2]..'</label><default>'..IESWCore(y[5],g[i],y[2],y[9],y[10],y[11],y[8],y[12],y[3],w)..'</default></data>')
			end
		elseif is(y[13]) then
			group:wikitext('<data source="'..y[2]..'"><label>'..y[2]..'</label></data>')
		else
			if y[2] == 'Ikona' then
			elseif y[2] == 'Nazwa' then
				name:attr('source',y[2])
				default:wikitext('<div class="pi-title-icon">'..title2.fullText:gsub('%b()','')..'</div>')
			elseif y[2] == 'Podtytuł' then
			elseif y[2] == 'Plik' then
				navigation:wikitext(IESWCaption('',w[j])):done()
			elseif y[2] == 'Mapa' then
				navigation:wikitext(IESWCaption('m',w[j])):done()
			else
				if is(l[i][2]) then
					group:wikitext('<data source="'..y[2]..'"><label>'..y[2]..'</label><default>'..l[i][2]..'</default></data>')
				elseif is(m[i][2]) then
					group:wikitext('<data source="'..y[2]..'"><label>'..y[2]..'</label><default>'..m[i][2]..'</default></data>')
				end
			end
		end
 
		z=mw.text.split(tostring(o[i+1]),':')
 
		if z[3] ~= y[3] and is(z[3]) then
			gr=gr..tostring(group)
			group=mw.html.create('group')
		end
 
	end
 
	gr=gr..tostring(group)
 
	name:node(default)
	mapa:node(map)
	infobox
		:node(name)
		:node(navigation)
		:node(file)
		:node(mapa)
		:wikitext(gr)
 
	e='[[Kategoria:'..c..']]{{#vardefine:a|{{#expr:{{#var:a}}+1}}}}{{#ifexpr:{{#var:a}}=1|{{#vardefine:l|0}}}}<div class="changebox" id="switch{{#var:l}}{{#vardefine:l|{{#expr:{{#var:l}}+1}}}}">'..e..tostring(infobox)..'</div>'
	return mw.getCurrentFrame():preprocess(e)
end
 
function IESWLine(v1,v2,v3)
	local success, result = pcall(function() return data['forms'][data[v1][mw.ustring.lower(v2)]][v3] end)
	return success and result or data["#default"] or v2
end
 
--(frame.args.s,frame.args[1],frame.args[2],frame.args.u,frame.args.sort,frame.args.r,frame.args.cat,frame.args.none)
function IESWCore(v1,v2,v3,v4,v5,v6,v7,v8,v9,wys)
	local value,l,s,w='','','',''
	local z,r,h={},{},{}
	if is(v2) then
		if is(v3) then
			w=v3
		else
			w=v9
		end
 
		s=v1
		v=mw.text.split(v2--[[:gsub('%[+(.-)%]+','%1')]]:gsub('<br>',','):gsub('\n',','),v6 or ',')
 
		for _,z in ipairs(v) do
			z=z
--				:gsub('.*:','')
				:gsub('~%(+(.-)%)+','<%1>'):gsub('%b()',''):gsub(';',','):gsub('%$',';')
			z=mw.text.trim(z):gsub('%<+(.-)%>+','(%1)')
 
			if not is(v4) then
				if not h[z] then
					r[#r+1]=z
					h[z]=true
				end
			else
				r=v
			end
		end
 
		if not is(v5) then
			table.sort(r)
		end
 
		for i=1, #r do
			if is(v7) then
				r[i]=IESWLine(v3,r[i],1)
			end
			l=r[i]
			if is(l) then
				if s == "i" then
						l='[[Plik:'..l..'|16px]]'
					elseif s == "k" then
						l='<div style="background:rgb('..l..')" class="pi-boxcolor"></div>'
					elseif s == "s" then
						l='[['..w..'::'..l..'|'..l:gsub('Zadanie:','')..']]'
					elseif s == "l" then
						l='[['..l..'|'..l:gsub('Zadanie:','')..']]'
					elseif s == "b" then
						l=l
					else
						l=l
				end
 
				value=value..'<div>'..l..'</div>'
			end
		end
		if is(v7) then
			value=value..'[[Kategoria:'..IESWLine(v3,mw.text.trim(l:gsub('%[+(.-)%]+','%1')),2)..']]'
		end
		if is(v8) then
			value=''
		else
			value=mw.getCurrentFrame():preprocess(value)
		end
	end
		return value
end
 
function IESWCaption(v1,w)
	local v,m,c='','',''
	if is(v1) then
		v2='_(mapa)'
		m='map'
	else
		v2=''
		m='grafik'
	end
 
	if title.namespace == 0 then
		v=v..'[[Kategoria:Bez grafiki w infoboksie]]'
	end
 
	v=v..'<div>Artykuł nie posiada '..m..'? <span class="plainlinks">['..tostring(mw.uri.fullUrl('Specjalna:Prześlij'))..' Dodaj je!]</span></div>'
 
	return v
end
 
function IESWFile(v1,v2,w)
	local v=''
	if not is(v2) then v2='' end
 
	if is(v1) then
		v=v..'[[Plik:'..v1..']]'
	end
 
	return v
 
end
 
function IESW.getLine(frame)
	if is(frame.args[4]) then
		return frame:preprocess(frame.args[1])
	else
		return frame:preprocess(IESWLine(frame.args[1],frame.args[2],tonumber(frame.args[3])))
	end
end
 
function is(v)
	return v ~= nil and v ~= ""
end
 
function _if(a,b,c)
	if a then return b else return c end
end
 
return IESW
--</source>

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.