Модуль:External links/data

Материал из Тептар
Перейти к навигации Перейти к поиску

Подмодуль Модуль:External links для отделения списка внешних ссылок от кода.


local data = {}

-- Функции для обработки специфичных ссылок
function imdbLink( id )
	if string.match( id, '^co' ) then
		return 'https://www.imdb.com/company/' .. id;
	end
	if string.match( id, '^ev' ) then
		return 'https://www.imdb.com/event/' .. id;
	end
	if string.match( id, '^nm' ) then
		return 'https://www.imdb.com/name/' .. id;
	end
	if string.match( id, '^tt' ) then
		return 'https://www.imdb.com/title/' .. id;
	end

	return false
end

function isniLink( id )
	id = id:gsub( '[ %-]', '' ):upper();
	return 'http://isni.org/isni/' .. id;
end

-- 1. Социальные сети
local socialNetworkProperties = {}
socialNetworkProperties.label = 'В социальных сетях'
socialNetworkProperties.list = {
	{ { 'Q116933', 'ВКонтакте' },		'P3185',			'https://vk.com/$1' },
	{ { 'Q918', 'X (Твиттер)' },		'P2002',			'https://x.com/$1' },
	{ { 'Q355', 'Facebook' }, 			'P2013',			'https://www.facebook.com/$1' },
	{ { 'Q209330', 'Instagram' },		'P2003',			'https://www.instagram.com/$1/' },
	{ { 'Q15616276', 'Telegram' },		'P3789',			'https://t.me/$1' },
	{ { 'Q15616276', 'Telegram' },		'P553:Q15616276',	'https://t.me/$1' },
	{ { 'Q4555537', 'Twitch' },			'P5797',			'https://www.twitch.tv/$1' },
}
table.insert( data, socialNetworkProperties )

-- 2. Фото, видео и аудио
local contentHostingProperties = {}
contentHostingProperties.label = 'Фото, видео и аудио'
contentHostingProperties.list = {
	{ { 'Q866', 'YouTube' },			'P2397',			'https://www.youtube.com/channel/$1' },
	{ { 'Q866', 'YouTube' },			'P553:Q866',		'https://www.youtube.com/$1' },
	{ { 'Q866', 'YouTube' },			'P4300',			'https://www.youtube.com/playlist?list=$1' },
}
table.insert( data, contentHostingProperties )

-- 3. Базовые тематические сайты
local themeProfilesProperties = {}
themeProfilesProperties.label = 'Тематические сайты'
themeProfilesProperties.list = {
	{ { 'Q364', 'GitHub' },				'P2037',			'https://github.com/$1' },
	{ { 'Q37312', 'Internet Movie Database' }, 'P345',		imdbLink },
}
table.insert( data, themeProfilesProperties )

-- 4. Главные библиографические каталоги (для авторитетного контроля)
local authorityControl = {}
authorityControl.label = 'В библиографических каталогах'
authorityControl.isAuthorityControl = true
authorityControl.list = {
	{ { 'Q423048', 'International Standard Name Identifier', 'ISNI' },	'P213',		isniLink, },
	{ { 'Q54919', 'Virtual International Authority File', 'VIAF' },		'P214',		'https://viaf.org/viaf/$1/', },
}
table.insert( data, authorityControl )

return data