Modul:Olympedia
Utseende
Moduldokumentasjon
[opprett]
local p = {}
local function getOlympediaID(qid)
local entity = mw.wikibase.getEntity(qid)
if not entity then return nil end
local claims = entity.claims and entity.claims['P8286']
if not claims or #claims == 0 then return nil end
return claims[1].mainsnak.datavalue.value
end
function p.inlineRef(frame)
local qid = frame.args[1]
if not qid or qid == '' then
qid = mw.wikibase.getEntityIdForCurrentPage()
end
local id = getOlympediaID(qid)
if not id then return '' end
local url = 'https://www.olympedia.org/athletes/' .. id
local citation = string.format(
'<ref>{{cite web |title=Olympedia – Athlete profile |url=%s |website=Olympedia |access-date=%s}}</ref>',
url,
os.date('%Y-%m-%d')
)
return citation
end
return p