FANDOM


--<source lang="lua">
--=IESW.main({args={'Test','Test',s='Test'}})
--Moduł z Elder Scrolls Wiki
--CC-BY-SA
--Autor: Vuh
IESW={}
 
local data=mw.loadData('Module:IESW/data')
local title2=mw.title.new(mw.title.getCurrentTitle().text)
local title=mw.title.getCurrentTitle()
 
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('group')
	local e,gr,ob,ma,t,c,v,w,debug='','','','','','','','',''
	local y,o,g,h,z,u,l,m={},{},{},{},{},{},{},{}
 
	local vFile={
		brak = true,
		nie = true,
		brak_pliku = true,
		nie_istnieje = true
	}
 
	mapa:tag('header'):wikitext('Mapa')
	sound:tag('header'):wikitext('Dźwięk')
 
	for i,x in pairs(frame.args) do
		u=mw.text.split(i,':')
		o[tonumber(u[1])]=i
		g[tonumber(u[1])]=x
		if u[2] == 'Występowanie' then w=mw.text.split(x:gsub('%[+(.-)%]+','%1'),',') end
		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],':')
		l[i]={'',''}
		l[i]=mw.text.split(g[i],'@%^')
		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}}}}" title="{{#switch:§|1H=Jednoręczny|2H=Dwuręczny|G1|GI|G I|G=Gothic|G2|GII|G II=Gothic II|G2:NK|G II:NK|GII:NK=Gothic II: Noc Kruka|GIII|G 3|G3=Gothic 3|G3ZB|G3:ZB=Gothic 3: Zmierzch Bogów|A:G4=ArcaniA|A:US=ArcaniA: Upadek Setariff|G3:P|G:P=Gothic 3: Początek|MT=Mroczne Tajemnice|Ret|Ret2=Returning|V–HW|V–Hw|V:HW|V:Hw=Velaya – Historia wojowniczki|G:ER=Gothic: Edycja rozszerzona|QP|QP4=Quest Pack 4|DK=Dzieje Khorinis}}">§</span>}}</div>'
				navigation:wikitext(navi):done()
			elseif y[2] == 'Plik' then
				if vFile[mw.ustring.lower(g[i]:gsub(' ','_'))] then
					navigation:wikitext('<div>Plik do danego artykułu nie istnieje. Nie wystąpił nigdy w serii [[The Elder Scrolls]].</div>'):done()
				else
					file=mw.html.create('image')
					file
						:attr('source',y[2])
						:tag('default')
						:wikitext('[[Plik:'..g[i]:gsub('Plik:','')..']]')
				end
			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
				if vFile[mw.ustring.lower(g[i]:gsub(' ','_'))] then
					navigation:wikitext('<div>Mapa do danego artykułu nie istnieje. Nie wystąpiła nigdy w serii [[The Elder Scrolls]].</div>'):done()
				else
						map=mw.html.create('image')
						map
							:attr('source',y[2])
							:tag('default')
							:wikitext('[[Plik:'..g[i]:gsub('Plik:','')..']]')
				end
			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] == 'Dźwięk' then
				sound:wikitext('<navigation><div class="showhide-onhover"><span class="audio_button">'..IESWSound(g[i]:gsub('Plik:',''),'',w[j])..'</span></div></navigation>')
			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]')
			elseif y[2] == 'szablon' then
				t=g[i]
			elseif y[2] == 'debug' then
				debug=g[i]
			elseif y[2] == 'kategoria' then
				c=g[i]
			elseif y[2] == 'motyw' then
				infobox:attr('theme',IESWLine('Występowanie',g[i]:gsub('%[+(.-)%]+','%1'),3))
			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
					if is(g[i]:gsub('Plik:','')) then
						file=mw.html.create('image')
						file
							:attr('source',y[2])
							:tag('default')
							:wikitext(g[i]:gsub('Plik:',''))
					else
						navigation:wikitext(IESWCaption('',w[j])):done()
					end
			elseif y[2] == 'Mapa' then
					if is(g[i]:gsub('Plik:','')) then
						map=mw.html.create('image')
						map
							:attr('source',y[2])
							:tag('default')
							:wikitext(g[i]:gsub('Plik:',''))
					else
						navigation:wikitext(IESWCaption('m',w[j])):done()
					end
			else
				if is(l[i][2]) then
					group:wikitext('<data source="'..y[2]..'"><label>'..y[2]..'</label><default>'..l[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)
		:node(sound)
		:wikitext(gr)
 
	e='{{#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>'
 
	if is(debug) then
		return mw.getCurrentFrame():preprocess('<pre>'..e..'</pre>')
	else
		return mw.getCurrentFrame():preprocess(e)
	end
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='','',''
	local z,r,h,li={},{},{},{}
	local k=0
	if is(v2) then
		if not is(v3) then
			v3=v9
		end
 
		s=v1
		v=mw.text.split(v2:gsub('<br>',','):gsub('<br />',','):gsub('\n',','),v6 or ',')
 
		for _,z in ipairs(v) do
			k=k+1
			li[k]=mw.text.split(z:gsub(';',','):gsub('%$',';'),'%~')
			z=li[k][1]:gsub('~%(+(.-)%)+','<%1>')
			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=z
			end
		end
 
		if not is(v5) then
			table.sort(r)
		end
 
		for i=1, #r do
			if is(v7) or v3 == 'Występowanie' then
				r[i]=IESWLine(v3,r[i],1)
			end
 
			l=r[i]:gsub('Zadanie:',''):gsub('%b()','')
 
			if is(r[i]) then
				if s == "i" then
					r[i]='[[Plik:'..r[i]..'|16px]]'
				elseif s == "k" then
					r[i]='<div style="background:rgb('..r[i]..')" class="pi-boxcolor"></div>'
				elseif s == "sw" then 
					for j=1, #wys do
						r[i]='[['..v3..'::'..l..IESWLine('Występowanie',wys[j],4)..'|'..l..']]'
					end
				elseif s == "s" then
					r[i]='[['..v3..'::'..r[i]..'|'..l..']]'
				elseif s == "l" then
					r[i]='[['..r[i]..'|'..l..']]'
				elseif s == "b" then
					r[i]=r[i]
				else
					r[i]='[['..v3..'::'..r[i]..'|'..l..']]'
				end
				if is(li[i][2]) then
					value=value..'<div data-line="'..v3..'">'..mw.text.trim(r[i]..' '..li[i][2])..'</div>'
				else
					value=value..'<div data-line="'..v3..'">'..r[i]..'</div>'
				end
				if is(v7) and is(wys) then
					if articlespace() then
						for j=1, #wys do
							value=value..'[[Kategoria:'..IESWLine('Występowanie',wys[j],2)..IESWLine(v3,l,2)..']]'
						end
					end
				end
			end
		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 articlespace() then
		v=v..'[[Kategoria:Bez grafiki]]'
	end
 
	v=v..'<div>Artykuł nie posiada '..m..'? <span class="plainlinks">['..tostring(mw.uri.fullUrl('Specjalna:Prześlij','wpDestFile='))..' Dodaj je!]</span></div>'
 
	return v
end
 
function articlespace()
	if title.namespace == 0 or title.namespace == 112 then
		return true
	else
		return false
	end
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)
	if v ~= '' and v ~= nil then
		return true
	else
		return false
	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.

Więcej z Fandomu

Losowa wiki