وحدة:Social linksيمكن إنشاء صفحة توثيق الوحدة في وحدة:Social links/شرح local p = {}
local getArgs = require('Module:Arguments').getArgs
local mw = mw
local socialPlatforms = {
facebook = {
property = 'P2013',
icon = 'Facebook icon 2013.svg',
label = 'فيسبوك',
wikiLink = '[[فيسبوك]]',
linkFormat = 'https://www.facebook.com/$1',
aliases = {'facebook', 'فيسبوك', 'فيس بوك'}
},
twitter = {
property = 'P2002',
icon = 'X logo 2023.svg',
label = 'إكس (تويتر)',
wikiLink = '[[تويتر]]',
linkFormat = 'https://x.com/$1',
aliases = {'twitter', 'x', 'تويتر'}
},
youtube = {
property = 'P2397',
icon = 'YouTube full-color icon (2017).svg',
label = 'يوتيوب',
wikiLink = '[[يوتيوب]]',
linkFormat = 'https://www.youtube.com/channel/$1',
aliases = {'youtube', 'يو تيوب', 'يوتيوب'}
},
instagram = {
property = 'P2003',
icon = 'Instagram logo 2016.svg',
label = 'انستجرام',
wikiLink = '[[انستجرام]]',
linkFormat = 'https://www.instagram.com/$1',
aliases = {'instagram', 'إنستغرام', 'انستغرام', 'إنستجرام', 'انستجرام'}
},
flickr = {
property = 'P3267',
icon = 'Flickr Shiny Icon.svg',
label = 'فليكر',
wikiLink = '[[فليكر]]',
linkFormat = 'https://www.flickr.com/photos//$1',
aliases = {'flickr', 'فليكر'}
},
linkedin = {
property = 'P6634',
icon = 'Linkedin icon.svg',
label = 'لينكد إن',
wikiLink = '[[لينكد إن]]',
linkFormat = 'https://www.linkedin.com/in/$1',
aliases = {'linkedin', 'لينكد إن', 'لينكد ان'}
},
soundcloud = {
property = 'P3040',
icon = 'Antu soundcloud.svg',
label = 'ساوند كلاود',
wikiLink = '[[ساوند كلاود]]',
linkFormat = 'https://soundcloud.com/$1',
aliases = {'soundcloud', 'ساوند كلاود', 'ساوندكلاود'}
},
myspace = {
property = 'P3265',
icon = 'Myspace.svg',
label = 'مايسبيس',
wikiLink = '[[مايسبيس]]',
linkFormat = 'https://myspace.com/$1',
aliases = {'myspace', 'مايسبيس'}
},
pinterest = {
property = 'P3836',
icon = 'Pinterest Shiny Icon.svg',
label = 'بنترست',
wikiLink = '[[بنترست]]',
linkFormat = 'https://www.pinterest.com/$1',
aliases = {'pinterest', 'بنترست'}
},
goodreads = {
property = 'P2963',
icon = "Goodreads_'g'_logo.svg",
label = 'مؤلف جودريدز',
wikiLink = '[[جود ريدز]]',
linkFormat = 'https://www.goodreads.com/author/show/$1',
aliases = {'goodreads', 'مؤلف جود ريدز', 'مؤلف جودريدز', 'مؤلف غود ريدز', 'مؤلف غودريدز'}
},
vk = {
property = 'P3185',
icon = 'VK Compact Logo (2021-present).svg',
label = 'ڤى كيه',
wikiLink = '[[ڤى كيه (خدمه)|ڤى كيه]]',
linkFormat = 'https://vk.com/$1',
aliases = {'vk', 'فكونتاكتي', 'فكونتاكتى', 'فى كيه', 'ڤى كيه'}
},
telegram = {
property = 'P3789',
icon = 'Telegram logo.svg',
label = 'تيليجرام',
wikiLink = '[[تيليجرام]]',
linkFormat = 'https://t.me/$1',
aliases = {'telegram', 'تيليجرام', 'تيليغرام', 'تلغرام', 'تلجرام', 'تلغرام', 'تلجرام'}
},
tumblr = {
property = 'P3943',
icon = 'Tumblr-2.svg',
label = 'تامبلر',
wikiLink = '[[تامبلر]]',
linkFormat = 'https://$1.tumblr.com',
aliases = {'tumblr', 'تامبلر', 'تمبلر'}
},
vine = {
property = 'P3207',
icon = 'Vine logo.svg',
label = 'ڤاين',
wikiLink = '[[ڤاين (خدمه)|ڤاين]]',
linkFormat = 'https://vine.co/u/$1',
aliases = {'vine', 'فاين', 'ڤاين'}
},
spotify = {
property = 'P1902',
icon = 'Spotify_icon.svg',
label = 'سبوتيفاى',
wikiLink = '[[سبوتيفاى]]',
linkFormat = 'https://open.spotify.com/artist/$1',
aliases = {'spotify', 'سبوتيفاى'}
},
snapchat = {
property = 'P2984',
icon = 'SnapChat!.jpg',
label = 'سناب شات',
wikiLink = '[[سناب شات]]',
linkFormat = 'https://www.snapchat.com/add/$1',
aliases = {'snapchat', 'سناب شات', 'سناب تشات'}
},
vimeo = {
property = 'P4015',
icon = 'Vimeo-icon-j.png',
label = 'فيميو',
wikiLink = '[[فيميو]]',
linkFormat = 'https://vimeo.com/$1',
aliases = {'vimeo', 'فيميو', 'فيمو'}
},
quora = {
property = 'P3417',
icon = 'Quora icon.svg',
label = 'كورا',
wikiLink = '[[كورا (ويب سايت)|كورا]]',
linkFormat = 'https://www.quora.com/topic/$1',
aliases = {'quora', 'كورا', 'كوارا', 'كيورا'}
},
tiktok = {
property = 'P7085',
icon = 'Iconoir tiktok.svg',
label = 'تيك توك',
wikiLink = '[[تيك توك]]',
linkFormat = 'https://www.tiktok.com/@/$1',
aliases = {'tiktok', 'تيك توك', 'تيكتوك'}
},
deezer = {
property = 'P2722',
icon = 'Deezer Icon.svg',
label = 'فنان ديزر',
wikiLink = '[[ديزر]]',
linkFormat = 'https://www.deezer.com/artist/$1',
aliases = {'deezer', 'ديزر'}
},
itunes = {
property = 'P2850',
icon = 'ITunes logo.svg',
label = 'فنان آى تيونز',
wikiLink = '[[آى تيونز]]',
linkFormat = 'https://itunes.apple.com/artist/$1',
aliases = {'itunes', 'آى تيونز'}
},
}
local function makeLink(platform, handle, name)
local icon = string.format('[[File:%s|link=|18px]]', platform.icon)
local platformLink = platform.wikiLink
local linkText = string.format('%s %s', icon, name or platform.label)
return string.format('[%s %s] على %s', platform.linkFormat:gsub('$1', handle), linkText, platformLink)
end
local function getWikidataValue(qid, property)
local entity = mw.wikibase.getEntity(qid)
if entity and entity.claims and entity.claims[property] and entity.claims[property][1] then
return entity.claims[property][1].mainsnak.datavalue.value
end
return nil
end
local function getLabel(qid)
local entity = mw.wikibase.getEntity(qid)
if entity then
local label = entity.labels and entity.labels.en and entity.labels.arz.value
if not label then
label = entity.labels and entity.labels.ar and entity.labels.en.value
end
return label
end
return nil
end
function p.main(frame)
local args = getArgs(frame)
local qid = args.QID or args.qid or mw.wikibase.getEntityIdForCurrentPage()
local name = mw.title.getCurrentTitle().text or args.name or getLabel(qid)
local result = {}
for site, data in pairs(socialPlatforms) do
local user_value
for _, alias in ipairs(data.aliases) do
if args[alias] then
user_value = args[alias]
break
end
end
local id
if user_value then
id = user_value
else
id = getWikidataValue(qid, data.property)
end
if id then
local link = makeLink(data, id, name)
table.insert(result, "* " .. link)
end
end
return string.format("\n%s\n", table.concat(result, "\n"))
end
return p
|
Index:
pl ar de en es fr it arz nl ja pt ceb sv uk vi war zh ru af ast az bg zh-min-nan bn be ca cs cy da et el eo eu fa gl ko hi hr id he ka la lv lt hu mk ms min no nn ce uz kk ro simple sk sl sr sh fi ta tt th tg azb tr ur zh-yue hy my ace als am an hyw ban bjn map-bms ba be-tarask bcl bpy bar bs br cv nv eml hif fo fy ga gd gu hak ha hsb io ig ilo ia ie os is jv kn ht ku ckb ky mrj lb lij li lmo mai mg ml zh-classical mr xmf mzn cdo mn nap new ne frr oc mhr or as pa pnb ps pms nds crh qu sa sah sco sq scn si sd szl su sw tl shn te bug vec vo wa wuu yi yo diq bat-smg zu lad kbd ang smn ab roa-rup frp arc gn av ay bh bi bo bxr cbk-zam co za dag ary se pdc dv dsb myv ext fur gv gag inh ki glk gan guw xal haw rw kbp pam csb kw km kv koi kg gom ks gcr lo lbe ltg lez nia ln jbo lg mt mi tw mwl mdf mnw nqo fj nah na nds-nl nrm nov om pi pag pap pfl pcd krc kaa ksh rm rue sm sat sc trv stq nso sn cu so srn kab roa-tara tet tpi to chr tum tk tyv udm ug vep fiu-vro vls wo xh zea ty ak bm ch ny ee ff got iu ik kl mad cr pih ami pwn pnt dz rmy rn sg st tn ss ti din chy ts kcg ve
Portal di Ensiklopedia Dunia