Документација модула[прикажи] [уреди] [историја] [освежи]

Начин рада уреди

Овај модул генерише текст коришћен у фуснотама изведеним са ставки Википодатака.

Функције уреди

Спољашње уреди

Спољашње функције прихватају објекте типа фрејма и предвиђени су за позивање из других модула или преко функције рашчлањивања {{#invoke:}}.

Директно позивање на функције модула у чланцима је крајње непожељно! У ту сврху користите одговарајуће шаблоне.

p.renderSource(frame) уреди

Враћа текст вики-везе до одређеног извора ради уметања у референцу или библиографију. Погледајте шаблоне {{source}} и {{извор}} који користе ову функцију. Подржава следеће аргументе:

  • frame.args[1] — анонимни аргумент који одређује идентификатор објекта на Википодацима помоћу којег би веза требало да се генерише. На пример, Q20750516.
  • frame.args['ref'] — поставља ознаку ref, која се касније може користити у шаблонима попут {{sfn}}.
  • frame.args['ref-year'] — поставља ознаку ref-year, која се користи слично као на ознаци ref.
  • frame.args['part'] — додатни аргумент за разјашњење дела извора на који се позива (на пример, поглавље у књизи).
  • frame.args['parturl'] — веза за део који је описан претходним аргументом.
  • frame.args['pages'] — одређене странице у извору на који се референца успоставља.
  • frame.args['url'] — омогућава изричито одређење која веза ће требати да се постави на извор.
  • frame.args['volume'] — омогућава изричито назначавање тома извора на који се референца односи.
  • frame.args['issue'] — омогућава изричито назначавање издања извора на који се референца односи.

Већина аргумената происходи из utils.copyArgsToSnaks. Сам преносни оквир се налази у p.currentFrame за даљу употребу и на основу аргумената прослеђених функцији artificialSnaks формира вештачки делови, која повезује на извор поменут у frame.args[1], кроз својства наведено у (P248) и тема (P805). Подаци се затим преносе у renderReferenceImpl за даљу обраду.

p.renderReference(frame, currentEntity, reference) уреди

Враћа форматиран вики текст референце датом извору. Подржава исте аргументе као и p.renderSource, а поред тога ref и ref-year. Погледајте шаблоне {{source-ref}} и {{ВП-фуснота}}, користећи ову функцију. Такође се користи у Модул:Wikidata да бисте приказали везе наведене поред упита са Википодатака. Ако недостају currentEntity и reference, ствара сопствени снек помоћу функције artificialSnaks, након чега се прослеђује у renderReferenceImpl. Ако је вики-текст за референцу успешно генерисан, обвијен је ознаком <ref> уз помоћ frame:extensionTag, при чему назив референце настаје хеширањем прослеђеног вики-текста у mw.hash.hashValue. Чланци са таквим фуснотама стављају се у Категорија:Википедија:Чланци са изворима из Викидата.

Унутрашње уреди

tokenizeName(fullName) уреди

Претвара пуно име у пар {презимена одвојена размацима, имена одвојена размацима} . Реализовано у облицима који се могу пронаћи на Википодацима:

  1. Презиме, Име
  2. Презиме, Име Име
  3. Презиме Презиме, Име
  4. Име Име огли Презиме
  5. Име Име де Презиме
  6. Име … Име Презиме (најмање једно и не више од четири појединачна имена)

Овде име, за разлику од презимена, може бити почетно. Ако није испуњен ниједан од горњих формата, враћа се пуно име непромењено.

personNameToAuthorName(fullName) уреди

Претвара пуно име у облик Презиме И. СИ. користећи tokenizeName.

personNameToResponsibleName(fullName) уреди

Претвара пуно име у облик И. СИ. Презиме користећи tokenizeName.

getPeopleAsWikitext(context, value, options) уреди

Претвара списак имена value у викитекст према списку опција options. Опције морају садржати следећа поља:

  1. separator — разделитељ на списку;
  2. conjunction — разделитељ пре последњег елемента списка;
  3. format — функција која трансформише имена у неком нормализованом облику (на пример, personNameToAuthorName);
  4. nolinks — логичка вредност, мора бити тачно ако је повезивање непожељно;
  5. preferids — логичка вредност, мора да буде тачно ако желите да вратите ид са Википодатака, а не имена.

Ако на спису има више аутора од броја maxAuthors (тренутно 10), остали се замењују са и др. или његових аналога (ако је језик одређен у контексту, тада i18nEtAl[context.lang], иначе се користи i18nEtAlDefault).

appendProperty(result, context, src, conjunctor, property, url) уреди

Надодаје src[property] на result, раздвајајући их линијом уписаном conjunctor. Ако је могуће, формира везу до src[url].

generateAuthorLinks(context, src) уреди

Враћа списак аутора src.author, оформљен путем getPeopleAsWikitext и уоквирен у <i class="wef_low_priority_links"></i>.

appendTitle(result, context, src) уреди

Надодаје на result текстуални низ src.part // src.title или само src.title ако src.part није прецизирано. Ако је могуће уоквиривање src.part (или src.title ако src.part није прецизирано) у src.url.

appendLanguage(result, context, src) уреди

Ако се context.lang разликује од i18nDefaultLanguage (српски у нашем случају), тада се назнака тога приписује result кроз Модул:Languages у формату {{ref-lang}}.

appendSubtitle(result, context, src) уреди

Надодаје на result текстуални низ : src.subtitle ако је src.subtitle дефинисано.

appendOriginalTitle(result, context, src) уреди

Надодаје на result текстуални низ  = src.originaltitle ако је src.originaltitle дефинисано.

appendPublication(result, context, src) уреди

Надодаје на result текстуални низ  // src.publication: src.publication.subtitle ако је дефинисано src.publication.subtitle, или  // src.publication ако је дефинисано src.publication.

appendEditor(result, context, src) уреди

Надодаје на result текстуални низ  / prefix src.editor ако је дефинисано src.editor, где је prefix дефинисано према context.lang (уобичајено, под ред.).

appendEdition(result, context, src) уреди

Надодаје на result текстуални низ  — src.edition ако је src.edition дефинисано.

appendPublicationData(result, context, src) уреди

Надодаје на result текстуални низ у облику  — src.place: src.publisher, src.year. ако је дефинисан бар један од наведених параметара. Неодређени део је изостављен, заједно са одговарајућом интерпункцијом. Дебело црево се користи само ако је наведено src.place и бар неки од src.publisher и src.year, зарез се ставља само ако је наведен и src.publisher, и src.year. Цртица и тачка користе се ако је наведен барем један од параметара.

appendVolumeAndIssue(result, context, src) уреди

Надодаје на result текстуални низ у облику  — letter_vol src.volume, letter_iss src.issue. ако је дефинисан бар један од наведених параметара. Зарез се користи ако су наведена оба параметра. letter_vol и letter_iss одређени на основу context.lang (на пример, Т. и вып. за руски текст, Vol. и Iss. за енглески).

appendPages(result, context, src) уреди

Надодаје на result текстуални низ у облику  — letter src.pages. ако је src.pages дефинисано, док је као сепаратор у src.pages, ако је распон страница, користи се симбол «—», а letter одређена на основу context.lang (на пример, P. за енглески и С. за руски).

appendNumberOfPages(result, context, src) уреди

Надодаје на result текстуални низ у облику  — src.numberOfPages letter ако је src.numberOfPages дефинисано. При чему је letter утврђено из context.lang (p. за енглески и с. за руски).

appendBookSeries(result, context, src) уреди

Надодаје на result текстуални низ у облику  — (src.bookSeries; letter_vol src.bookSeriesVolume, letter_iss src.bookSeriesIssue) ако је src.bookSeries дефинисано. Тачка са зарезом само ако је дефинисано src.bookSeriesVolume или src.bookSeriesIssue, зарез се користи ако су наведена оба параметра. letter_vol и letter_iss утврђено из context.lang, слично ономе како ради appendVolumeAndIssue.

appendBookSeries(result, context, src) уреди

Надодаје на result информацију из src.tirage ако је дефинисано. Формат се одређује из context.lang, за енглески језик је то  — ed. size: src.tirage, а за руски  — src.tirage экз..

appendIdentifiers(result, context, src) уреди

Надодаје на result идентификаторе ISBN, ISSN, DOI, PMID и arXiv ако су наведени. Идентификаторима се додељује цртица, тачнији формат је дефинисан у табелама options_commas, options_issn, options_doi, options_pmid и options_arxiv.

appendSourceId(result, context, src) уреди

Надодаје на result у <span class="wikidata_cite citetype" data-entity-id="src.sourceId"></span>, где citetyle је src.type ако је ово поље дефинисано и citetype_unknown у супоротном случају.

appendAccessDate(result, context, src) уреди

Надодаје на result текстуални низ у виду <small>Проверено dd month yyyy.</small>, где dd, month и yyyy потичу од src.accessdate ако је ово поље дефинисано.

populateUrl(context, src) уреди

Ако је src.url недефинисан, али је src.sourceId познат, покушава доделити src.url везу.

populateYear(src) уреди

Ако је src.year недефинисан, покушава да испуни са src.dateOfPublication и src.dateOfCreation.

populateTitle(src) уреди

Ако је src.title недефинисан, покушава да придружи src.url, ако и ово није могуће, додељује ''(недефинисан наслов)''.

renderSource(context, src) уреди

Унутрашња функција која генерише текст који ће се приказати у референци. Понаша се на следећи начин:

  1. Записује src.lang у context.lang (или i18nDefaultLanguage ако src.lang није записан).
  2. Позива populateUrl, populateTitle и populateYear.
  3. Формира променљиву result, с почетка дефинисану са generateAuthorLinks(context, src).
  4. Доследно примењује на result функцију appendTitle—appendAccessDate, док је блок appendEditor—appendAccessDate додатно уоквирен са &lt;span class="wef_low_priority_links"&gt;&lt;/span&gt;

artificialSnaks(args) уреди

Прави вештачки снек, која повезује извор са идентификатором frame.args[1] путем својства наведено у (P248) и тема (P805), а такође прослеђује и аргументе (том, издање итд.).

Услужни подмодули уреди

Коришћена својства Википодатака уреди

Својство Напомене
аутор (P50)
скраћено име аутора (P2093)
језик дела или имена (P407)
изворни језик дела (P364)
одељак (P958) користи се за означавање наслова чланка у енциклопедији
наслов (P1476) ако је потребно преправити назив ознаке ставке
поднаслов (P1680)
пуно дело доступно на (P953)
URL архиве (P1065)
URL референце (P854)
објављено у (P1433)
број издања (P393)
издавач (P123)
место издавања (P291)
уредник (P98)
страница/е (P304)
број страна (P1104)
том (P478)
публикација (P433)
настанак (P571)
датум издавања (P577)
ISBN-13 (P212)
ISBN-10 (P957)
ISSN (P236)
редни број (P1545)
(P818)
(P888)

Тестови [ уређивање ] уреди

Неуспелих тестова: 4

test_Sources:

Текст Очекивано Стварно
НеН {{#invoke:Sources | renderSource | Q20750516}} Президент Российской Федерации Указ Президента Российской Федерации от 15 јануара 1992 г. № 23 «О Генеральном директоре Агентства федеральной безопасности Российской Федерации и Министре внутренних дел Российской Федерации» (рус.) // Собрание законодательства Российской Федерации — 1992. президент России Указ Президента Российской Федерации от 15 јануара 1992 г. № 23 «О Генеральном директоре Агентства федеральной безопасности Российской Федерации и Министре внутренних дел Российской Федерации» (рус.) // Собрание законодательства Российской Федерации — 1992.
ДаY {{#invoke:Sources | renderSource | Q21683979}} Advances in Cryptology — EUROCRYPT 2004 (енг.): International Conference on the Theory and Applications of Cryptographic Techniques, Interlaken, Switzerland, May 2-6, 2004. Proceedings / ed.C. Cachin, J. L. CamenischSpringer, Berlin, Heidelberg, 2004. — 630 p. — ISBN 978-3-540-21935-4doi:10.1007/B97182 Advances in Cryptology — EUROCRYPT 2004 (енг.): International Conference on the Theory and Applications of Cryptographic Techniques, Interlaken, Switzerland, May 2-6, 2004. Proceedings / ed.C. Cachin, J. L. CamenischSpringer, Berlin, Heidelberg, 2004. — 630 p. — ISBN 978-3-540-21935-4doi:10.1007/B97182
НеН {{#invoke:Sources | renderSource | Q21683981}} Nguyen P. Q. Can We Trust Cryptographic Software? Cryptographic Flaws in GNU Privacy Guard v1.2.3 (енг.) // Advances in Cryptology — EUROCRYPT 2004: International Conference on the Theory and Applications of Cryptographic Techniques, Interlaken, Switzerland, May 2-6, 2004. Proceedings / ed.C. Cachin, J. L. CamenischSpringer, Berlin, Heidelberg, 2004. — P.  555—570. — 630 p. — ISBN 978-3-540-21935-4doi:10.1007/978-3-540-24676-3_33 Nguyen P. Can We Trust Cryptographic Software? Cryptographic Flaws in GNU Privacy Guard v1.2.3 (енг.) // Advances in Cryptology — EUROCRYPT 2004: International Conference on the Theory and Applications of Cryptographic Techniques, Interlaken, Switzerland, May 2-6, 2004. Proceedings / ed.C. Cachin, J. L. CamenischSpringer, Berlin, Heidelberg, 2004. — P.  555—570. — 630 p. — ISBN 978-3-540-21935-4doi:10.1007/978-3-540-24676-3_33
НеН {{#invoke:Sources | renderSource | Q21725400}} Eichenauer J., Lehn J. A non-linear congruential pseudo random number generator (енг.) // Statistische HefteSpringer Berlin Heidelberg, 1986. — vol.  27, Iss.  1. — P.  315—326. — ISSN 0932-5026doi:10.1007/BF02932576 Eichenauer J., Lehn J. A non-linear congruential pseudo random number generator (енг.) // Statistische HefteSpringer Berlin Heidelberg, Springer Science+Business Media, 1986. — vol.  27, Iss.  1. — P.  315—326. — ISSN 0932-5026; 1613-9798doi:10.1007/BF02932576
ДаY {{#invoke:Sources | renderSource | Q21725116}} Menezes A. J., Oorschot P. v., Vanstone S. A. Handbook of Applied Cryptography (енг.)CRC Press, 1996. — 816 p. — (Discrete Mathematics and Its Applications) — ISBN 978-0-8493-8523-0 Menezes A. J., Oorschot P. v., Vanstone S. A. Handbook of Applied Cryptography (енг.)CRC Press, 1996. — 816 p. — (Discrete Mathematics and Its Applications) — ISBN 978-0-8493-8523-0
НеН {{#invoke:Sources | renderSource | Q27450585}} Введение в криптографию (рус.) / под ред. В. В. ЯщенкоМ.: МЦНМО, 2000. — 271 с. — ISBN 978-5-900916-26-2 Введение в криптографию (рус.) / под ред. В. В. ЯщенкоМ.: МЦНМО, 2000. — 271 с. — ISBN 978-5-900916-26-2

local p = {}

local langs = require('Module:Languages')
local utils = require('Module:Sources/utils')

local i18nDefaultLanguage = 'sr'

local i18nEtAlDefault = ' et al.'
local i18nEtAl = {
	bs	    = ' i dr.',
	hr	    = ' i dr.',
	de	    = ' et al.',
	en	    = ' et al.',
	ru	    = ' и др.',
	sr	    = ' и др.',
}

local i18nEditors = {
	bs	    = 'ured.',
	hr	    = 'ured.',
	de	    = 'Hrsg.: ',
	en	    = 'ed.',
	ru	    = 'под ред. ',
	sr	    = 'уред.',
}

local i18nTranslators = {
	bs	    = 'prev.',
	hr	    = 'prev.',
	de	    = 'Ü.: ',
	en	    = 'tr. ',
	ru	    = 'пер. ',
	sr	    = 'прев. ',
}

local i18nVolume = {
	bs	    = 'tom.',
	hr	    = 'tom.',
	de	    = 'Jg.: ',
	en	    = 'vol. ',
	ru	    = 'Т. ',
	sr	    = 'том. ',
}

local i18nIssue = {
	bs	    = 'ed.',
	hr	    = 'ed.',
	de	    = 'H.: ',
	en	    = 'Iss. ',
	ru	    = 'вып. ',
	sr	    = 'изд. ',
}

local i18nPages = {
	bs	    = 'str.',
	hr	    = 'str.',
	de	    = 'S.: ',
	en	    = 'P. ',
	ru	    = 'С. ',
	sr	    = 'стр. ',
}

local i18nNumberOfPages = {
	bs	    = 'br. str.',
	hr	    = 'br. str.',
	de	    = 'u.S.: ',
	en	    = 'p. ',
	ru	    = 'с. ',
	sr	    = 'бр. стр. ',
}

local i18nTirage = {
	bs	    = 'tiraž: %d',
	hr	    = 'tiraž: %d',
	de	    = 'K.: %d',
	en	    = 'ed. size: %d',
	ru	    = '%d экз.',
	sr   = 'тираж: %d',
}


local monthg = {'јануара', 'фебруара', 'марта', 'априла', 'маја', 'јуна', 'јула', 'августа', "септембра", "октобра", "новембра", "децембра"}

local PREFIX_CITEREF = "CITEREF_";

-- Враћа форматирани пар {презиме(на), име(на)}
local function tokenizeName( fullName )
	local start = '^%s*' -- подудара почетак текстуалног низа + произвољан број размака
	local finish = '%s*$' -- подудара крај текстуалног низа + произвољан број размака
	local comma = '\,%s+' -- подудара тачку + један или више размака
	local space = '%s+' -- подудара један или више размака
	local name = '(%a[%a\-\']*)\.?' -- подудара појединачно име, које почиње словом, може садржати апострофе и наводнике, и може се завршавати тачком
	local surname = '(%a[%a\-\']*)' -- Исто као за име, али се не може завршавати тачком
	
	local f, i = mw.ustring.match(fullName, start .. surname .. comma .. name .. finish)
	if f then
		mw.log('tokenizeName: «' .. fullName .. '»: садржи «Fa, Im» подударање')
		return {f, mw.ustring.sub( i, 1, 1 ) .. '.'}
	end
	
	local f, i, o = mw.ustring.match(fullName, start .. surname .. comma .. name .. space .. name .. finish)
	if f then
		mw.log( 'tokenizeName: «' .. fullName .. '»: садржи «Fa, Im Ot» подударање')
		return {f, mw.ustring.sub( i, 1, 1 ) .. '.&nbsp;'
				.. mw.ustring.sub( o, 1, 1 ) .. '.'}
	end

	local f1, f2, i = mw.ustring.match(fullName, start .. surname .. space .. surname .. comma .. name .. finish)
	if f1 then
		mw.log('tokenizeName: «' .. fullName .. '»: садржи «Fa Fa, Im» подударање')
		return {f1 .. '&nbsp;' .. f2, mw.ustring.sub( i, 1, 1 ) .. '.'}
	end
	
	local i, o, f = mw.ustring.match(fullName, start .. name .. space .. name .. space .. 'оглы' .. space .. surname .. finish)
	if f then
		mw.log('tokenizeName: «' .. fullName .. '»: садржи «Im Ot оглы Fa» подударање')
		return {f, mw.ustring.sub(i, 1, 1) .. '.&nbsp;' .. mw.ustring.sub(o, 1, 1) .. '.'}
	end

	local i1, i2, f = mw.ustring.match(fullName, start .. name .. space .. name .. space .. 'de' .. space .. surname .. finish)
	if f then
		mw.log('tokenizeName: «' .. fullName .. '»: садржи «Im Im de Fa» подударање')
		return {f, mw.ustring.sub( i1, 1, 1 ) .. '.&nbsp;' .. mw.ustring.sub( i2, 1, 1 ) .. '.'}
	end
	
	-- Try matching k names + surname
	for k = 1, 4 do
		pattern = start .. string.rep(name .. space, k) .. surname .. finish
		matched = {mw.ustring.match(fullName, pattern)}
		if #matched ~= 0 then
			mw.log('tokenizeName: «' .. fullName .. '»: садржи «Im (x' .. k .. ') Fa» подударање')
			for i = 1, k do
				matched[i] = mw.ustring.sub(matched[i], 1, 1)
			end
			return {matched[k + 1], table.concat(matched, '.&nbsp;', 1, k) .. '.'}
		end
	end
	
	mw.log('Не подудара се ни са једним шаблоном: «' .. fullName .. '»')
	return {fullName}
end

local function personNameToAuthorName( fullName )
	if not fullName then return fullName end
	local tokenized = tokenizeName(fullName)
	if #tokenized == 1 then
		return tokenized[1]
	else
		return tokenized[1] .. '&nbsp;' .. tokenized[2]
	end
end

local function personNameToResponsibleName( fullName )
	if not fullName then return fullName end
	local tokenized = tokenizeName(fullName)
	if #tokenized == 1 then
		return tokenized[1]
	else
		return tokenized[2] .. '&nbsp;' .. tokenized[1]
	end
end


local options_commas = { separator = ', ', conjunction = ', ', format = function( src ) return src end, nolinks = false, preferids = false };
local options_commas_short = { separator = ', ', conjunction = ', ', format = function( src ) return src end, nolinks = false, preferids = false, short = true };
local options_commas_nolinks = { separator = ', ', conjunction = ', ', format = function( src ) return src end, nolinks = true, preferids = false };
local options_commas_it = { separator = ', ', conjunction = ', ', format = function( src ) return "''" .. src .. "''" end, nolinks = false, preferids = false };
local options_commas_it_short = { separator = ', ', conjunction = ', ', format = function( src ) return "''" .. src .. "''" end, nolinks = false, preferids = false, short = true };
local options_commas_it_nolinks = { separator = ', ', conjunction = ', ', format = function( src ) return "''" .. src .. "''" end, nolinks = true , preferids = false };
local options_citetypes = { separator = ' ', conjunction = ' ', format = function( src ) return 'citetype_' .. src end, nolinks = true , preferids = true };

local options_commas_authors = { separator = ', ', conjunction = ', ', format = personNameToAuthorName, nolinks = false, preferids = false };
local options_commas_responsible = { separator = ', ', conjunction = ', ', format = personNameToResponsibleName, nolinks = false, preferids = false };

local options_arxiv = { separator = '; ', conjunction = '; ', format = function( id ) return '[http://arxiv.org/abs/' .. id .. ' arXiv:' .. id .. ']' end, nolinks = true, preferids = false };
local options_doi = { separator = '; ', conjunction = '; ', format = function( doi ) return '[http://dx.doi.org/' .. doi .. ' doi:' .. doi .. ']' end, nolinks = true, preferids = false };
local options_issn = { separator = '; ', conjunction = '; ', format = function( issn ) return '[https://www.worldcat.org/issn/' .. issn .. ' ' .. issn .. ']' end, nolinks = true, preferids = false };
local options_pmid = { separator = '; ', conjunction = '; ', format = function( pmid ) return '[https://www.ncbi.nlm.nih.gov/pubmed/?term=' .. pmid .. ' PMID:' .. pmid .. ']' end, nolinks = true, preferids = false };

local function getPersonNameAsLabel( context, entityId, providedLabel, options )
	-- would custom label provided we don't need to check entity at all
	if ( not utils.isEmpty( providedLabel ) ) then
		mw.log( 'Custom label provided for ' .. entityId );
		return options.format( providedLabel );
	end

	local entity = utils.getEntity( context, entityId );
	if ( not entity ) then return '\'\'(ентитет ' .. entityId .. ' недостаје)\'\'' end;

	local personName = nil;
	-- support only labels so far
	if ( entity.labels[ context.lang ] ) then
		personName = entity.labels[ context.lang ].value;
		mw.log('Добављено име особе од ' .. entityId .. ' од назива: «' .. personName .. '»' )
	end

	if ( not utils.isInstanceOf( entity, 'Q5' ) ) then
		mw.log( 'Ентитет ' .. entityId .. ' није особа' );
		return personName;
	end

	if ( utils.isEmpty( personName ) ) then
		return '\'\'(није преведено на ' .. context.lang .. ')\'\'';
	else
		return options.format( personName );
	end
end

local function getPersonNameAsWikitext( context, entityId, customLabel, options )
	local personName = getPersonNameAsLabel( context, entityId, customLabel, options);
	if ( personName == nil ) then
		return nil;
	end

	local link = utils.getElementLink( context, entityId, nil );
	return utils.wrapInUrl( link, personName );
end

local function getPeopleAsWikitext( context, value, options )
	if type( value ) == 'string' then
		return options.format( value )
	elseif type( value ) == 'table' then
		if value.id then
			-- ово је веза
			if options.preferids then
				return value.id
			else
				if options.nolinks then
					return getPersonNameAsLabel( context, value.id, value.label, options )
				else
					return getPersonNameAsWikitext( context, value.id, value.label, options )
				end
			end
		end
		
		local maxAuthors = 10 -- потребна су ограничења, пошто поједине публикације садрже прекомеран број аутора (нпр. 115 аутора за Q68951544)
		local resultList = {}
		for i, tableValue in pairs( value ) do
			local nextWikitext = getPeopleAsWikitext( context, tableValue, options )
			if not utils.isEmpty( nextWikitext ) then
				table.insert( resultList, nextWikitext )
				if #resultList == maxAuthors + 1 then
					-- задржи још једно за означавање да их је превише
					break
				end
			end
		end

		local resultWikitext = ''
		for i, wikitext in pairs( resultList ) do
			if i == maxAuthors + 1 then
				resultWikitext = resultWikitext .. ( i18nEtAl[ context.lang ] or i18nEtAlDefault )
				break;
			end
			if i ~= 1 then
				resultWikitext = resultWikitext .. ', '
			end
			resultWikitext = resultWikitext .. wikitext
		end

		return resultWikitext
	end

	return options.format( '(непознат тип)' )
end

local function generateAuthorLinks(context, src)
	local result = ''
	if src.author then
		result = getPeopleAsWikitext( context, src.author, options_commas_authors )
		result = '<i class="wef_low_priority_links">' .. result .. '</i> '
	end
	return result
end

local function appendProperty(result, context, src, conjunctor, property, url)
	if src[property] then
		if url and src[url] then
			result = result .. conjunctor .. utils.wrapInUrl( src[url], utils.toString( context, src[property], options_commas_nolinks ) )
		else
			result = result .. conjunctor .. utils.toString( context, src[property], options_commas )
		end
	end
	return result
end

local function appendTitle(result, context, src)
	conjunctor = ''
 	if src.part then
 		result = appendProperty(result, context, src, '', 'part', 'parturl')
 		conjunctor = ' // '
 	end
 	result = appendProperty(result, context, src, conjunctor, 'title', 'url')
 	return result
end

local function appendLanguage(result, context, src)
	if context.lang ~= i18nDefaultLanguage then
		result = result .. langs.list_ref(p.currentFrame:newChild{ args = {context.lang} })
	end
	return result
end

local function appendSubtitle(result, context, src)
	return appendProperty(result, context, src, ': ', 'subtitle')
end

local function appendOriginalTitle(result, context, src)
	return appendProperty(result, context, src, ' = ', 'originaltitle')
end

local function appendPublication(result, context, src)
	if src.publication then
		if type( src.publication.title or '') ~= 'string' then
			error('тип src.publication.title није текстуални низ већ ' .. type( src.publication.title ) )
		end
		
		result = result .. ' // ' .. utils.toString( context, src.publication, options_commas_it_short )
		if src.publication.subtitle then
			result = result .. ': ' .. utils.toString( context, src.publication.subtitle, options_commas_it_short )
		end
	end
	return result
end

local function appendEditor(result, context, src)
	if src.editor or src.translator then
		result = result .. ' / '
		if src.editor then
			local prefix = i18nEditors[ context.lang ] or i18nEditors[ i18nDefaultLanguage ]
			result = result .. prefix .. getPeopleAsWikitext( context, src.editor, options_commas_responsible )
			if src.translator then
				result = result .. ', '
			end
		end
		if src.translator then
			local prefix = i18nTranslators[ context.lang ] or i18nTranslators[ i18nDefaultLanguage ]
			result = result .. prefix .. getPeopleAsWikitext( context, src.translator, options_commas_responsible )
		end
	end
	return result
end

local function appendEdition(result, context, src)
	return appendProperty(result, context, src, ' — ', 'edition')
end

local function appendPublicationData(result, context, src)
	if src.place or src.publisher or src.year then
		result = result .. ' — '
		if src.place then
			result = result .. utils.toString( context, src.place, options_commas_short )
			if src.publisher or src.year then
				result = result .. ': '
			end
		end
		if src.publisher then
			result = result .. utils.toString( context, src.publisher, options_commas_short )
			if src.year then
				result = result .. ', '
			end
		end
		if src.year then
			result = result .. utils.toString( context, src.year, options_commas )
		end
		result = result .. '.';
	end
	return result
end

local function appendVolumeAndIssue(result, context, src)
 	if src.volume or src.issue then
 		result = result .. ' — '
		local letter_vol = i18nVolume[ context.lang ] or i18nVolume[ i18nDefaultLanguage ]
		local letter_iss = i18nIssue[ context.lang ] or i18nIssue[ i18nDefaultLanguage ]
		if src.volume then
			result = appendProperty(result, context, src, letter_vol .. '&nbsp;', 'volume')
			result = appendProperty(result, context, src, ', ' .. letter_iss .. '&nbsp;', 'issue')
		else
			result = appendProperty(result, context, src, letter_iss .. '&nbsp;', 'issue')
		end
		result = result .. '.'
 	end
 	return result
end

local function appendPages(result, context, src)
	if src.pages then
		local letter = i18nPages[ context.lang ] or i18nPages[ i18nDefaultLanguage ]
		local strPages = utils.toString( context, src.pages, options_commas )
		strPages = mw.ustring.gsub( strPages, '[-—]', '—' );
		result = result .. ' — ' .. letter .. '&nbsp;' .. strPages .. '.'
	end
	return result
end

local function appendNumberOfPages(result, context, src)
	if src.numberOfPages then
		local letter = i18nNumberOfPages[ context.lang ] or i18nNumberOfPages[ i18nDefaultLanguage ]
		result = appendProperty(result, context, src, ' — ', 'numberOfPages') .. '&nbsp;' .. letter
	end
	return result
end

local function appendBookSeries(result, context, src)
	if src.bookSeries then
		result = appendProperty(result, context, src, ' — (', 'bookSeries')
	 	if src.bookSeriesVolume or src.bookSeriesIssue then
	 		result = result .. '; '
	 		local letter_vol = i18nVolume[ context.lang ] or i18nVolume[ i18nDefaultLanguage ]
	 		local letter_iss = i18nIssue[ context.lang ] or i18nIssue[ i18nDefaultLanguage ]
			if ( src.bookSeriesVolume ) then
				result = appendProperty(result, context, src, letter_vol .. '&nbsp;', 'bookSeriesVolume')
				result = appendProperty(result, context, src, ', ' .. letter_iss .. '&nbsp;', 'bookSeriesIssue')
			else
				result = appendProperty(result, context, src, letter_iss .. '&nbsp;', 'bookSeriesIssue')
			end
	 	end
		result = result .. ')'
	end
	return result
end

local function appendTirage(result, context, src)
	if src.tirage then
		local tirageTemplate = i18nTirage[ context.lang ] or i18nTirage[ i18nDefaultLanguage ]
		result = result .. ' — ' .. utils.toString( context, src.tirage, { separator = '; ', conjunction = '; ', format = function( data ) return mw.ustring.format(tirageTemplate, data) end } )
	end
	return result
end

local function appendIdentifiers(result, context, src)
	if src.isbn  then result = result .. ' — ISBN ' .. utils.toString( context, src.isbn, options_commas )	end
	if src.issn  then result = result .. ' — ISSN ' .. utils.toString( context, src.issn, options_issn )	end
	if src.doi   then result = result .. ' — ' .. utils.toString( context, src.doi, options_doi )			end
	if src.pmid  then result = result .. ' — ' .. utils.toString( context, src.pmid, options_pmid )			end
	if src.arxiv then result = result .. ' — ' .. utils.toString( context, src.arxiv, options_arxiv )		end
	return result
end

local function appendSourceId(result, context, src)
	if src.sourceId then
		local citetype = src.type and utils.toString(context, src.type, options_citetypes) or 'citetype_unknown'
		result = '<span class="wikidata_cite ' .. citetype .. '" data-entity-id="' .. utils.getSingle(src.sourceId) .. '">' .. result .. '</span>'
	end
	return result
end

local function appendAccessDate(result, context, src)
	if src.accessdate then
			local date = utils.getSingle(src.accessdate)
			local pattern = "(%-?%d+)%-(%d+)%-(%d+)T";
			local y, m, d = mw.ustring.match(date, pattern)
			y, m, d = tonumber(y), tonumber(m), tonumber(d)
			result = result .. " <small>Проверено " .. tostring(d) .. " " .. monthg[m]  .. " " .. tostring(y) .. ".</small>"
	end
	return result
end

local function populateUrl(context, src)
	if src.sourceId and not src.url then
		local entity = utils.getEntity(context, src.sourceId)
		if entity.sitelinks and entity.sitelinks[context.lang .. 'wikisource'] then
			src.url = ':' .. context.lang .. ':s:' .. entity.sitelinks[context.lang .. 'wikisource'].title
		end
	end
end

local function populateYear(src)
	if not src.year and src.dateOfPublication then
		local date = utils.getSingle(src.dateOfPublication)
		src.year = mw.ustring.sub(date, 2, 5)
	end
	if not src.year and src.dateOfCreation then
		local date = utils.getSingle(src.dateOfCreation)
		src.year = mw.ustring.sub(date, 2, 5)
	end
end

local function populateTitle(src)
	src.title = src.title or utils.getSingle(src.url) or '\'\'(неназначен наслов)\'\''
end

local function renderSource(context, src)
	options_commas_authors.format = personNameToAuthorName
	options_commas_responsible.format = personNameToResponsibleName

	context.lang = utils.getLangCode(utils.getSingle(src.lang)) or i18nDefaultLanguage

	utils.preprocessPlaces(src, context.lang)

	populateUrl(context, src)
	populateTitle(src)
	populateYear(src)

	local result = generateAuthorLinks(context, src)
	result = appendTitle(result, context, src)
	result = appendLanguage(result, context, src)
	result = appendSubtitle(result, context, src)
	result = appendOriginalTitle(result, context, src)
	result = appendPublication(result, context, src)
	
	result = result .. '<span class="wef_low_priority_links">'
	result = appendEditor(result, context, src) -- Можда користи тренутог уредника уместо жељеног. Користити пажљиво
	result = appendEdition(result, context, src)
	result = appendPublicationData(result, context, src)
	result = appendVolumeAndIssue(result, context, src)
	result = appendPages(result, context, src)
	result = appendNumberOfPages(result, context, src)
	result = appendBookSeries(result, context, src)
	result = appendTirage(result, context, src)
	result = appendIdentifiers(result, context, src)
	result = appendSourceId(result, context, src)
	result = appendAccessDate(result, context, src)
	result = result .. '</span>'

	return result
end

local function renderReferenceImpl(currentEntity, reference, refAnchor, refAnchorYear)
	if not reference.snaks then
		return nil
	end

	-- контекст, содержит также кеш элементов
	local context = {
		cache = {}
	}

	-- подаци у основном формату у складу са библиографским описним модулима
	local data = {}

    -- прибављање података из референце
    utils.populateDataFromClaims(context, nil, reference.snaks, data)

	utils.expandSpecials(context, currentEntity, reference, data)

	local sourceEntity = nil
	if data.sourceId then
		sourceEntity = utils.getEntity(context, data.sourceId)
		if sourceEntity then
			utils.populateSourceDataImpl(context, sourceEntity, data)
		end
	end

	if data.publication then
		utils.expandPublication(context, sourceEntity, data)
	end

	utils.expandBookSeries(context, data)

	if next(data) == nil then
		return nil
	end

	local rendered = renderSource(context, data)
	if mw.ustring.len(rendered) == 0 then
		return nil
	end

	if refAnchor then
		local anchorValue = 'CITEREF' .. refAnchor .. (utils.coalesce(refAnchorYear, data.year) or '')
		rendered = '<span class="citation" id="' .. mw.uri.anchorEncode(anchorValue) .. '">' .. rendered .. '</span>'
	end

	return rendered
end

local function artificialSnaks(args)
	local snaks = {}
	if args[1] then
		entityId = mw.text.trim(args[1])
		snaks.P248 = {utils.toWikibaseEntityIdSnak("P248", entityId)}
		snaks.P805 = {utils.toWikibaseEntityIdSnak("P805", entityId)}
	end
	utils.copyArgsToSnaks(args, snaks)
	return mw.wikibase.getEntity(), {snaks = snaks}
end

function p.renderReference(frame, currentEntity, reference)
	p.currentFrame = frame

	-- позив шаблона
	if frame and not currentEntity and not reference then
		currentEntity, reference = artificialSnaks(frame.args)
	end

	local rendered = renderReferenceImpl(currentEntity, reference)
	if not rendered then
		return ''
	end
	-- За избор алгоритма распршивања вид. [[Модуль:Hash]]. Подвлака на почетку омогућава
    -- да искључите грешку када је назив фусноте чисто бројевна вредност, која понекад садржи хешеве.
	return frame:extensionTag('ref', rendered, {name = '_' .. mw.hash.hashValue('fnv164', rendered)}) .. '[[Category:Википедија:Чланци са изворима са Викидата]]'
end

function p.renderSource(frame)
	p.currentFrame = frame
	currentEntity, reference = artificialSnaks(frame.args)
	return renderReferenceImpl(currentEntity, reference, frame.args['ref'], frame.args['ref-year'])
end

return p;