Modul:CitWeb

Innen: kotta
Ugrás a navigációhoz Ugrás a kereséshez
A nyomtatható változat már nem támogatott, és hibásan jelenhet meg. Kérjük, frissítsd a böngésződ könyvjelzőit, és használd a böngésző alapértelmezett nyomtatás funkcióját.

A modult a Modul:CitWeb/doc lapon tudod dokumentálni

--Version 2014_05_23
require 'Modul:No globals'
local ds = require('Modul:Dátumszűrés')
local getArgs = require('Modul:Arguments').getArgs
local args = {}
local lang = mw.getContentLanguage()

local lans = {
	['an'] = true,
	['ar'] = true,
	['aze'] = true,
	['be'] = true,
	['bg'] = true,
	['bn'] = true,
	['bs'] = true, 
	['ca'] = true, 
	['chm'] = true,
	['cy'] = true,
	['cs'] = true,
	['da'] = true,
	['de'] = true,
	['ee'] = true,
	['el'] = true,
	['en'] = true,
	['eo'] = true,
	['es'] = true,
	['et'] = true,
	['eu'] = true,
	['fa'] = true,
	['fi'] = true,
	['fo'] = true,
	['fr'] = true,
	['fy'] = true,
	['ga'] = true,
	['gd'] = true,
	['gl'] = true,
	['grc'] = true,
	['gu'] = true,
	['he'] = true,
	['hi'] = true,
	['hr'] = true,
	['ht'] = true,
	['hu'] = true,
	['hy'] = true,
	['hz'] = true,
	['id'] = true,
	['is'] = true,
	['it'] = true,
	['ja'] = true,
	['jp'] = true,
	['ka'] = true,
	['kk'] = true, 
	['km'] = true,
	['kn'] = true,
	['ko'] = true,
	['ku'] = true,
	['ky'] = true,
	['lat'] = true,
	['lb'] = true,
	['lo'] = true,
	['lit'] = true,
	['lv'] = true,
	['mk'] = true,
	['mn'] = true,
	['mo'] = true,
	['ms'] = true,
	['mt'] = true,
	['my'] = true,
	['ne'] = true,
	['nl'] = true,
	['nn'] = true,
	['no'] = true,
	['oc'] = true,
	['pa'] = true,
	['pl'] = true,
	['pt'] = true,
	['rm'] = true,
	['ro'] = true,
	['ru'] = true,
	['rue'] = true,
	['sa'] = true,
	['sah'] = true,
	['scn'] = true,
	['se'] = true,
	['sh'] = true,
	['sk'] = true,
	['slo'] = true,
	['sm'] = true,
	['sq'] = true,
	['sr'] = true,
	['sv'] = true, 
	['tam'] = true,
	['te'] = true,
	['tet'] = true,
	['tg'] = true,
	['th'] = true,
	['tk'] = true,
	['tag'] = true,
	['to'] = true,
	['tr'] = true,
	['tat'] = true,
	['ty'] = true,
	['uk'] = true,
	['ur'] = true,
	['uz'] = true,
	['vi'] = true,
	['yi'] = true,
	['zh'] = true
}

local hibavan = false

-- hibakeresésre szolgáló globális változó, ami tartalmazza az analízisre
-- szolgáló üzeneteket, az alábbi pop() függvény gyűjtögeti a tartalmát
local ou = ''

local function pop(...)  -- idézőjeles rész és bővítmények az ou számára
	do return end -- memóriatúllépést okoz, csak teszteléshez
	local list = {...}
	for _, var in pairs(list) do
		ou = ou .. tostring(var) .. '\n '
		mw.log(ou)
	end
end

-- Egy hibaüzenet kezelése.
-- Igazra állítja a hibavan változót és visszatér a megjeleníthető hibaüzenettel
-- @argument about: A hibaüzenet (string)
local function error(about)
	hibavan = true  
	local r = about
    if type( about ) == 'string' then
        if #about == 0 then
            r = 'Lua-hiba'
        end
    else
        r = tostring( about )
    end
    return '<span class="error">' .. r .. '</span>, '
end

-- URL-ben nem használható paraméterek (szóköz, macskaköröm stb.) kódolása
local function encodeURL(url)
	if type(url) ~= 'string' then
		return url
	end
	url = string.gsub(url, '%s','%%20')
	url = string.gsub(url, '"', '%%22')
	url = string.gsub(url, "'", '%%27')
	url = string.gsub(url, '<', '%%3c')
	url = string.gsub(url, '>', '%%3e')
	url = string.gsub(url, '%[','%%5b')
	url = string.gsub(url, '%]','%%5d')
	url = string.gsub(url, '{', '%%7b')
	url = string.gsub(url, '|', '%%7c')
	url = string.gsub(url, '}', '%%7d')
	return url
end

local function isISSN(str)
	local v, chsum
	str = string.gsub(str, '–' , '-') -- nagykötőjelből kicsi lesz
	str = string.gsub(str, '—' , '-') -- hetvenkvirtesből kicsi lesz
	local i, j = string.find(str, '-')
	if i == j and i == 5 then -- rendben, az ötödik helyen van a kötőjel
		v = string.sub(str,1,4) .. string.sub(str,6,8)
		chd = string.sub (str,-1,-1)
	else
		return false
	end
	if chd == 'X' or tonumber(chd) then
		if chd == 'X' then
			chnum = 10
		else
			chnum = string.byte(chd, 1) - string.byte('0', 1)
		end 
	else
		return false
	end 
	if tonumber(v) then 
		chsum = 0
		for j = 8, 2, -1 do
			local elsbyte = string.byte(v, (9 - j))
			chsum = chsum + (elsbyte - string.byte('0', 1)) * j
		end
	else
		return false -- nem számjegyek
	end
	local chnumdo = 11 - (chsum % 11)    
	if chnumdo == chnum then
		return true
	else
		return false 
	end
end

--CitWeb
--[[
    {{citweb |url= |szerző= |szerző2= |szerző3= |cím= |alcím=  |közreműködők= 
    {{citweb |url= |aut=    |aut2=    |aut3=    |tit= |subtit= |ass=   --Alternatív paraméterekkel 
    |weblap= |nyelvkód= |hely= |kiadó= |dátum= vagy év= |oldal= |elér= 
    |work=   |lan=      |loc=  |red=   |date= vagy ann= |pag=   |accd= 	
    |formátum= |méret= |archívurl= |archívdátum= |doi= |egyéb= |idézet= }}
	|form=     |siz=        |aurl=      |archd=       |doi= |misc=  |quote= }}  
--]]    	

-- Egy sablonparaméter lekérdezése.
-- Az üres paramétereket nilként adja át.
-- A sablonhívásban fel kell sorolni a paraméterneveket:
-- pl. getArg('aut', 'szerző', 'author')
local function getArg(...)
	for _, v in ipairs{...} do
		if args[v] and args[v] ~= '' then
			return args[v]
		end
	end
	return nil
end

local url, szerzo, szerzo2, szerzo3, szerzo4, szerzo5, szerzo6, szerzo7, szerzo8, szerzo9
local cim, alcim, forditas_cime, datum, publication_date, outdatum, nyelv, lan, english
local ass,weblap,red,loc, publication_place, ev, ho,nap, oldal, deadurl, form,size,formsiz,aurl,archd,doi, isbn, issn, accd,misc,quote
local szerzolink,szerzolink2,szerzolink3,szerzolink4,szerzolink5,szerzolink6,szerzolink7,szerzolink8,szerzolink9
local month, year, origyear, at, template_doc_demo, _format, tipus, sorozat, nopp
-- local id, arxiv, _asin, _asin_tld, bibcode, doi_brokendate, jfm, jstor
-- local lccn, mr, oclc, ol, osti, pmc, embargo, pmid, rfc, ssrn, zbl
local layurl, laysource, laydate, author_mask, author_name_separator, author_separator
local display_authors, display_editors, lastauthoramp, postscript, separator

local function _nilez()
	szerzo, szerzo2, szerzo3, szerzo4, szerzo5 = nil
	szerzo6, szerzo7, szerzo8, szerzo9, cim, alcim = nil
	ass, weblap, lan, loc, red, ev, datum, accd, form, size, aurl, archd, misc = nil
end

local function angol_parameterek()
	local szerzo_csaladneve, szerzo2_csaladneve, szerzo3_csaladneve, szerzo4_csaladneve
	local szerzo5_csaladneve, szerzo6_csaladneve, szerzo7_csaladneve, szerzo8_csaladneve, szerzo9_csaladneve
	local szerzo_keresztneve, szerzo2_keresztneve, szerzo3_keresztneve, szerzo4_keresztneve
	local szerzo5_keresztneve, szerzo6_keresztneve, szerzo7_keresztneve, szerzo8_keresztneve, szerzo9_keresztneve
	local szerkeszto_csaladneve, szerkeszto2_csaladneve, szerkeszto3_csaladneve, szerkeszto4_csaladneve
	local szerkeszto_keresztneve, szerkeszto2_keresztneve, szerkeszto3_keresztneve, szerkeszto4_keresztneve

	cim = getArg('title')
	datum = getArg('date')
	accd = getArg('accessdate')
	aurl = encodeURL(getArg('archiveurl'))
	archd = getArg('archivedate')
	weblap = getArg('website', 'work')
	red = getArg('publisher')
	szerzo_csaladneve  = getArg('last', 'author', 'last1', 'author1', 'authors')
	szerzo2_csaladneve = getArg('last2', 'author2')
	szerzo3_csaladneve = getArg('last3', 'author3')
	szerzo4_csaladneve = getArg('last4', 'author4')
	szerzo5_csaladneve = getArg('last5', 'author5')
	szerzo6_csaladneve = getArg('last6', 'author6')
	szerzo7_csaladneve = getArg('last7', 'author7')
	szerzo8_csaladneve = getArg('last8', 'author8')
	szerzo9_csaladneve = getArg('last9', 'author9')

    szerzo_keresztneve  = getArg('first', 'first1')
	szerzo2_keresztneve = getArg('first2')
	szerzo3_keresztneve = getArg('first3')
	szerzo4_keresztneve = getArg('first4')
	szerzo5_keresztneve = getArg('first5')
	szerzo6_keresztneve = getArg('first6')
	szerzo7_keresztneve = getArg('first7')
	szerzo8_keresztneve = getArg('first8')
	szerzo9_keresztneve = getArg('first9')
	
	if szerzo_csaladneve then
		szerzo = szerzo_csaladneve
		if szerzo_keresztneve then
			szerzo = szerzo .. ', ' .. szerzo_keresztneve
		end
	end
    if szerzo2_csaladneve then
		szerzo2 = szerzo2_csaladneve
		if szerzo2_keresztneve then
			szerzo2 = szerzo2 .. ', ' .. szerzo2_keresztneve
		end
	end
    if szerzo3_csaladneve then
		szerzo3 = szerzo3_csaladneve
		if szerzo3_keresztneve then
			szerzo3 = szerzo3 .. ', ' .. szerzo3_keresztneve
		end
	end
    if szerzo4_csaladneve then
		szerzo4 = szerzo4_csaladneve
		if szerzo4_keresztneve then
			szerzo4 = szerzo4 .. ', ' .. szerzo4_keresztneve
		end
	end
    if szerzo5_csaladneve then
		szerzo5 = szerzo5_csaladneve
		if szerzo5_keresztneve then
			szerzo5 = szerzo5 .. ', ' .. szerzo5_keresztneve
		end
	end
    if szerzo6_csaladneve then
		szerzo6 = szerzo6_csaladneve
		if szerzo6_keresztneve then
			szerzo6 = szerzo6 .. ', ' .. szerzo6_keresztneve
		end
	end
    if szerzo7_csaladneve then
		szerzo7 = szerzo7_csaladneve
		if szerzo7_keresztneve then
			szerzo7 = szerzo7 .. ', ' .. szerzo7_keresztneve
		end
	end
    if szerzo8_csaladneve then
		szerzo8 = szerzo8_csaladneve
		if szerzo8_keresztneve then
			szerzo8 = szerzo8 .. ', ' .. szerzo8_keresztneve
		end
	end
    if szerzo9_csaladneve then
		szerzo9 = szerzo9_csaladneve
		if szerzo9_keresztneve then
			szerzo9 = szerzo9 .. ', ' .. szerzo9_keresztneve
		end
	end
	
	szerzolink = getArg('authorlink', 'authorlink1', 'author-link1', 'author1-link', 'author1link')
	if szerzolink then szerzo = '[[' .. szerzolink .. ']]' end
	szerzolink2 = getArg('authorlink2', 'author2-link')
	if szerzolink2 then szerzo2 = '[[' .. szerzolink2 .. ']]' end
	szerzolink3 = getArg('authorlink3', 'author3-link')
	if szerzolink3 then szerzo3 = '[[' .. szerzolink3 .. ']]' end
	szerzolink4 = getArg('authorlink4', 'author4-link')
	if szerzolink4 then szerzo4 = '[[' .. szerzolink4 .. ']]' end
	szerzolink5 = getArg('authorlink5', 'author5-link')
	if szerzolink5 then szerzo5 = '[[' .. szerzolink5 .. ']]' end
	szerzolink6 = getArg('authorlink6', 'author6-link')
	if szerzolink6 then szerzo6 = '[[' .. szerzolink6 .. ']]' end
	szerzolink7 = getArg('authorlink7', 'author7-link')
	if szerzolink7 then szerzo7 = '[[' .. szerzolink7 .. ']]' end
	szerzolink8 = getArg('authorlink8', 'author8-link')
	if szerzolink8 then szerzo8 = '[[' .. szerzolink8 .. ']]' end
	szerzolink9 = getArg('authorlink9', 'author9-link')
	if szerzolink9 then szerzo9 = '[[' .. szerzolink9 .. ']]' end
	datum = getArg('date', 'year')
	origyear = getArg('origyear')

	ass = getArg('others')
	lan = getArg('language')
	cim = getArg('title')
	forditas_cime = getArg('trans_title')
	loc = getArg('place','location')
	red = getArg('publisher')
	publication_date = getArg('publication-date')
	if publication_date then 
		if select(2, ds.datumszuro(publication_date)) == select(2, ds.datumszuro(datum)) then
			publication_date = nil 
		else
			datum = publication_date
		end
	end -- csak akkor tekintjük létezőnek, ha különbözik a dátumtól		
	publication_place = getArg('publication-place')

	szerkeszto_csaladneve = getArg('editor-last','editor1-last', 'editor', 'editors')
	szerkeszto_keresztneve = getArg('editor-first', 'editor1-first')
	szerkeszto2_csaladneve = getArg('editor2-last')
	szerkeszto2_keresztneve = getArg('editor2-first')
	szerkeszto3_csaladneve = getArg('editor3-last')
	szerkeszto3_keresztneve = getArg('editor3-first')
	szerkeszto4_csaladneve = getArg('editor4-last')
	szerkeszto4_keresztneve = getArg('editor4-first')

	local szerkesztok = {}
	if szerkeszto_csaladneve then
		szerkeszto = szerkeszto_csaladneve
		if szerkeszto_keresztneve then
			szerkeszto = szerkeszto .. ', ' .. szerkeszto_keresztneve
		end
		table.insert(szerkesztok, szerkeszto)
	end
	if szerkeszto2_csaladneve then
		szerkeszto2 = szerkeszto2_csaladneve
		if szerkeszto2_keresztneve then
			szerkeszto2 = szerkeszto2 .. ', ' .. szerkeszto2_keresztneve
		end
		table.insert(szerkesztok, szerkeszto2)
	end
	if szerkeszto3_csaladneve then
		szerkeszto3 = szerkeszto3_csaladneve
		if szerkeszto3_keresztneve then
			szerkeszto3 = szerkeszto3 .. ', ' .. szerkeszto3_keresztneve
		end
		table.insert(szerkesztok, szerkeszto3)
	end
	if szerkeszto4_csaladneve then
		szerkeszto4 = szerkeszto4_csaladneve
		if szerkeszto4_keresztneve then
			szerkeszto4 = szerkeszto4 .. ', ' .. szerkeszto4_keresztneve
		end
		table.insert(szerkesztok, szerkeszto4)
	end
	if #szerkesztok > 0 then
		szerkeszto = 'szerk.: ' .. table.concat(szerkesztok, '&#8201;&#8211;&#8201;')
	end
	
	oldal = getArg('page', 'pages')
	nopp = getArg('nopp')
	if not oldal then
		at = getArg('at')
	end
	deadurl = getArg(' deadurl')
	template_doc_demo = (getArg('template doc demo') == 'true')
	_format = getArg('format')
	if _format then
		_format= '( '.._format..') '
	end
	isbn = getArg('isbn')
	issn = getArg('issn')
	
	--Quote
	quote = getArg('quote')
	doi = getArg('doi')
	tipus = getArg('type')
	sorozat = getArg('series', 'version')
	if sorozat then
		sorozat = 'Sorozat: ' .. sorozat .. ' '
	else
		sorozat = getArg('agency')
	end
	
	--[[ nem használja semmi
	id = getArg('id')   
	if not id then  
		arxiv = getArg('arxiv')
		_asin = getArg('asin')
		_asin_tld = getArg('asin-tld')
		
		bibcode = getArg('bibcode')
		doi_brokendate = getArg('doi_brokendate')
		jfm = getArg('jfm')
		jstor = getArg('jstor')
		lccn = getArg('lccn') 
		mr = getArg('mr')
		oclc = getArg('oclc')
		ol = getArg('ol')
		osti = getArg('osti')
		pmc = getArg('pmc')
		embargo = getArg('embargo')
		pmid = getArg('pmid')
		rfc = getArg('rfc')
		ssrn = getArg('ssrn')
		zbl = getArg('zbl')
	end
	--]]
	 
	--Laysummary
	layurl = getArg('layurl')
	laysource = getArg('laysource')
	laydate = getArg('laydate')
	
	--Display options
	author_mask = getArg('author-mask')
	author_name_separator = getArg('author-name-separator')
	author_separator = getArg('author-separator')
	display_authors = getArg('display-authors')
	display_editors = getArg('display-editors')
	lastauthoramp = getArg('lastauthoramp')
	postscript = getArg('postscript')
	separator = getArg('separator')
end

local function magyar_e()
	local function cleanArg(...)
		local arg = getArg(...)
		if arg then
			return (string.gsub(arg, '[%[%]]', ''))
		else
			return nil
		end
	end
	url = getArg('url')
	szerzo  = getArg('szerző',  'aut' )
	szerzo2 = getArg('szerző2', 'aut2')
	szerzo3 = getArg('szerző3', 'aut3')
	szerzo4 = getArg('szerző4', 'aut4')
	szerzo5 = getArg('szerző5', 'aut5')
	szerzo6 = getArg('szerző6', 'aut6')
	szerzo7 = getArg('szerző7', 'aut7')
	szerzo8 = getArg('szerző8', 'aut8')
	szerzo9 = getArg('szerző9', 'aut9')
	cim = getArg('cím', 'tit')
	alcim = getArg('alcím', 'subtit')
	ass = getArg('ass', 'közreműködők')
	weblap = getArg('weblap', 'work')
	lan = getArg('lan', 'nyelvkód')
	loc = getArg('loc', 'hely')
	red = getArg('red', 'kiadó')
	ev = cleanArg('év', 'ann')
	datum = cleanArg('dátum', 'date')
	oldal = getArg('oldal', 'pag')
	accd = cleanArg('elér', 'accd')
	form = getArg('form', 'formátum')
	size = getArg('siz', 'méret')
	aurl = getArg('aurl', 'archívurl')
	archd = cleanArg('archd', 'archívdátum')
	doi = getArg('doi') 
	misc = getArg('egyéb', 'misc')
	quote = getArg('quote', 'idézet')
	local x = szerzo or szerzo2 or szerzo3 or szerzo4 or szerzo5 or szerzo6
		or szerzo7 or szerzo8 or szerzo9 or cim or alcim or ass or lan or loc
		or red or ev or accd or form or size or aurl or archd  or misc
	return (x ~= nil)
end

local function _citweb()
	_nilez()
	local hiba_jelzes = nil
	local igen_magyar = magyar_e()
 
	if not igen_magyar then
		angol_parameterek()
	end

	hiba_jelzes = ''

	-- a szerzőket előre lépteti, társszerzőből szerzőt csinál stb.
	local szerzok = {}
	if szerzo then
		table.insert(szerzok, szerzo)
	end
	if szerzo2 then
		table.insert(szerzok, szerzo2)
	end
	if szerzo3 then
		table.insert(szerzok, szerzo3)
	end
	if szerzo4 then
		table.insert(szerzok, szerzo4)
	end
	if szerzo5 then
		table.insert(szerzok, szerzo5)
	end
	if szerzo6 then
		table.insert(szerzok, szerzo6)
	end
	if szerzo7 then
		table.insert(szerzok, szerzo7)
	end
	if szerzo8 then
		table.insert(szerzok, szerzo8)
	end
	if szerzo9 then
		table.insert(szerzok, szerzo9)
	end
	if #szerzok > 0 then
		szerzo = table.concat(szerzok, '&#8201;&#8211;&#8201;') .. ': '
	else
		szerzo = nil
	end
	
	--cím és alcím
	local terminator
	if cim then
		cim = mw.text.trim(lang:ucfirst(cim))
	else
		hiba_jelzes = hiba_jelzes .. error('nincs elsődleges cím')
	end
	if cim and alcim then
		alcim = lang:ucfirst(alcim)
		if string.sub(cim, -1, -1) ~= ':' then
			cim = cim .. ': ' .. alcim
		else
			cim = cim .. ' ' .. alcim
		end
	end
	if cim then
		terminator = string.sub(cim, -1, -1)
		if terminator ~= '?' and terminator ~= '!' and terminator ~= ',' and terminator ~= '.' and terminator ~= '\166' then
			cim = cim .. '.'
		end   
		
		-- SZÜKSÉGES CSERÉK:
		--newline 	[ 	     ] 	     |    Ezek kellenek, mert az URL ráhúzásakor bezavarnak
		--space    &#91; 	&#93; 	&#124;
		if forditas_cime then
			cim = cim .. ' [' .. forditas_cime .. '] '
		end
		cim = string.gsub(cim, '\n', ' ')
		cim = string.gsub(cim, '%[', '&#91;')  
		cim = string.gsub(cim, '%]', '&#93;')
		cim = string.gsub(cim, '%|', '&#124;')
	end
	
	-- asszisztencia
	if ass then
		ass = lang:ucfirst(ass) .. ' '
	end
	
	url = getArg('url'); pop('url', url)
	url = encodeURL(url)
	
  	-- weblap
  	-- pop('weblap', weblap or 'nincs eddig')
	if not (weblap or red) and url then
		local maradek, i, _
		_, i = string.find(url, '//')
		if i then
			maradek = string.sub(url, i+1, -1)
			_, i = string.find(maradek, '/')
			if i then
				weblap = string.sub(maradek, 1, i-1)
			else
				weblap = maradek
			end
		end
	end
	
	-- nyelvkód
	if lan then
		if cim == nil then
			hiba_jelzes = hiba_jelzes .. ' ' .. error('nyelv cím nélkül')
		else
			if lans[lan] then
				nyelv = ' ' .. mw.getCurrentFrame():expandTemplate{ title = lan, args = { lan } }
			else -- különben mi magunk kiírjuk, mert így beszédesebb
				hiba_jelzes = hiba_jelzes .. ' ' .. error('ismeretlen nyelvkód')
			end
		end
	end
	
	-- loc, red
	local kiadas = loc
	if red then
		kiadas = (kiadas and kiadas .. ': ' or '') .. red
	end

	if kiadas and nyelv then
		nyelv = nyelv .. '.'
	elseif kiadas and weblap then
		weblap = weblap .. '.'
	end
	
	-- form és size
	
	local c = ''
	if form then
		c = form
	end
	if size then
		if string.sub(size, -5, -1) == 'oldal' then
			size = string.sub(size, 1, -6)
		end
		if c ~= '' then
			c = c .. ': ' .. size .. ' oldal '
		else
			c = size .. ' oldal '
		end
	end
	if c ~= '' then
		formsiz = '(' .. c .. ')'
	end
	
	if ev and not datum then
		datum = ev -- ha nincs dátum, akkor az év legyen a dátum
	end		

	if datum then -- ha van dátum (most már vagy a dátum, vagy ennek hiányában az év)
		local nyom =''
		local nyom, dou = ds.datumszuro(datum)
		if dou then
			outdatum =  '(' .. ds.honapnevesdate(dou) .. ') '
		else
			hiba_jelzes = hiba_jelzes .. ' ' .. error('hibás dátum')
		end
	end
	
	-- oldaladatok
  	if oldal then
		oldal = string.gsub(oldal, '-' ,  '–') -- kiskötőjelből nagy
		oldal = string.gsub(oldal, '—' ,  '–') -- hetvenkvirtesből nagy
		oldal = string.gsub(oldal, '%.,', ',') -- pontot követő veszőből vesszőt
		oldal = string.gsub(oldal, '%.',  '' ) -- pontból üreset
		oldal = string.gsub(oldal, ',',  '.,') -- végül vesszőből ponot követő vesszőt
		if nopp == 'y' then
			oldal = '&#x20;' .. oldal
		else
			oldal = '&#x20;' .. oldal .. '. o. '
		end
	end
	
	-- Archiválva
	aurl = encodeURL(aurl)
	if archd then -- ha van dátum
		local outarchd, dou
		dou = select(2, ds.datumszuro(archd))
		if dou then
			outarchd = ds.honapnevesdate(dou)
			if aurl then 
				archd = '<span title="' .. outarchd .. '">[' .. aurl .. ' arch]</span>'
			else
				hiba_jelzes  = hiba_jelzes .. ' ' .. error('archívdátum van, de archívurl nélkül')
			end
		else
			hiba_jelzes  = hiba_jelzes .. ' ' .. error('hibás archívdátum')
		end  -- if dou  	 	
	end	-- if archd
	
	-- elérés
	if not accd then
		accd = getArg('accessdate')
	end
	if accd then -- ha van elérés
		local outaccd, dou
		dou = select(2, ds.datumszuro(accd))
		if dou then
			outaccd = ds.honapnevesdate(dou)
			accd = '(Hozzáférés: ' .. outaccd .. ')'
		else
			hiba_jelzes = hiba_jelzes .. ' ' .. error('hibás elérés')
		end  -- if dou  	 	
	end	-- if accd

	if issn then 
		if isISSN (issn) then
			issn = '<span title="' .. issn .. '" style="color:blue;">ISSN</span>'
		else
			hiba_jelzes = hiba_jelzes .. ' ' .. error('hibás ISSN: ') .. issn
		end    
	else
		issn = '' -- ha nem létezik, legyen üres
	end
	isbn = getArg('isbn'); pop('isbn=', isbn)
	if isbn then
		local isbn_helyes, hibas
		isbn_helyes, isbn, hibas = require('Modul:CheckISBN').isISBN(isbn, true) -- linkelve az ISBN-ek
		if not isbn_helyes then
			pop('hibás ISBN', hibas)
			hibavan = true
			hiba_jelzes = hiba_jelzes .. ' ' .. hibas
		end
	end
	
	if doi then 
		local doicontrol
		doicontrol = string.sub(doi,1,2)
		if doicontrol ~= '10' then
			hiba_jelzes = hiba_jelzes .. ' ' .. error('doi kötelezően 10-zel kezdődik!')
		else
			doi = '<span title="' .. doi .. '">[http://dx.doi.org/' .. doi .. ' doi]</span>'
		end
	end
	
	-- misc lekezelése
	if misc then
		misc = misc .. '.'
	end
	
	-- URL lekezelése
	if url and cim then
		url = encodeURL(url)
		if deadurl and deadurl ~= 'no' and aurl then
			cim = '[' .. aurl .. ' ' .. cim .. ']'
		else
			cim = '[' .. url .. ' ' .. cim .. ']'
		end
	end
	
	--idézet
	if quote then
		quote = " ''„" .. quote .. "”''"
	end
	
	-- eredmény összeállítása
	local s = {}
	local function tabla(x)
		if x then
			table.insert(s, x)
		end
	end
	if igen_magyar then
		tabla(szerzo)
		tabla(cim)
		tabla(ass)
		tabla(weblap)
		tabla(nyelv)
		tabla(kiadas)
		tabla(outdatum)
		tabla(oldal)
		tabla(accd)
		tabla(formsiz)
		tabla(archd)
		tabla(doi)
		tabla(misc)
		tabla(quote)
		tabla(isbn)
	else
		tabla(szerzo)
		tabla(cim)
		tabla(_format)
		tabla(nyelv)
		if tipus then table.insert(s, ' (' .. tipus .. ')') end
		tabla(ass)
		tabla(weblap)
		tabla(kiadas)
		tabla(outdatum)
		if origyear then table.insert(s, ' (' .. origyear .. ')') end
		tabla(oldal)
		tabla(at)
		tabla(sorozat)
		tabla(accd)
		tabla(formsiz)
		tabla(archd)
		tabla(doi)
		tabla(isbn)
		tabla(issn)
	end
	-- tabla(ou)
	if hibavan and (igen_magyar or not template_doc_demo) then
		table.insert(s, hiba_jelzes .. '[[Kategória:Hibás paraméterezésű CitWeb-et tartalmazó lapok]]')
	end
	return mw.text.trim(table.concat(s, ' '))
end --citweb

local function run(frame)
	args = getArgs(frame)
	return _citweb()
end

return {
	run = run -- az egyetlen átadandó függvény
}