Модуль:RefTools

Материал из Кадровый состав НКВД 1935-1939
Версия от 01:12, 5 февраля 2017; StasR (обсуждение | вклад) (¶)
(разн.) ← Предыдущая версия | Текущая версия (разн.) | Следующая версия → (разн.)
Перейти к навигации Перейти к поиску

Для документации этого модуля может быть создана страница Модуль:RefTools/doc

local refTools = {}
tools = tools or require( 'Module:Tools' )

function refTools.makeRef( para, isSource )
	local refs = mw.text.split( para, '¶' ) 
	prefix = prefix or ''
	local result = ''
	local name, content
	for _, ref in pairs( refs ) do
		name, content = mw.ustring.match ( ref, '^/([^/]+)/(.*)$' ) 
		if not name then
			content = ref
		end
		
		if isSource then
			content = 'Источник: <cite>' .. content .. '</cite>'
		else
			content = tools.phrase( content )
		end
		result = result .. mw.getCurrentFrame():extensionTag( 'ref', content, name )
	end
	return result
end

return refTools