Modul:FacebookLink
Implementează {{Facebook}}
local p = {}
local getArgs = require('Modul:Arguments').getArgs
local wikidata = require('Modul:Wikidata')
local function findLink(id, qId)
if id then return wikidata.formatExternalLink('P2013', qId, id)
else
local props = {'P2013', 'P1997'}
for _,eachProp in ipairs(props) do
if wikidata.findOneValueNoRef(eachProp) then return wikidata.formatExternalLink(eachProp, qId) end
end
end
end
local function displayLink(id, label, qId)
local link = findLink(id, qId)
if link then
return '[' .. link .. ' ' .. label .. '] pe [[Facebook]]'
end
return nil
end
local function displayLinkFromFrame(frame)
local args = getArgs(frame)
local id = args[1] or args['id']
local label = args[2] or args['name'] or args['nume'] or wikidata.findLabel() or mw.title.getCurrentTitle().text
local qId = args['q'] or args['qid']
return displayLink(id, label, qId)
end
p.fromArgs = displayLink
p.fromFrame = displayLinkFromFrame
return p