Module:TFRRS
Implements {{TFRRS}}
Tracking category
local p = {}
function p.TFRRS(frame)
local f = frame.args
local pf = frame:getParent().args
local turls = {}
local ids = {}
local xcs = {}
local labels = {}
local nameslugs = {}
local teamslugs = {}
local maxparam = 0
if pf[1] or pf['id'] then
ids[1] = pf[1] or pf['id']
maxparam = 1
end
if pf['nameslug'] then
nameslugs[1] = pf['nameslug']
end
if pf['teamslug'] then
teamslugs[1] = pf['teamslug']
end
if pf['xc'] then
xcs[1] = pf['xc']
end
for k, v in pairs(pf) do
if type(k) == 'string' then
paramno = tonumber(string.match(k, '^%a*([1-9][0-9]*)$'))
if paramno then
if paramno > maxparam then
maxparam = paramno
end
if k:find('^id[1-9][0-9]*$') then
ids[paramno] = v
elseif k:find('^label[1-9][0-9]*$') then
labels[paramno] = v
elseif k:find('^xc[1-9][0-9]*$') then
xcs[paramno] = v
elseif k:find('^nameslug[1-9][0-9]*$') then
nameslugs[paramno] = v
elseif k:find('^teamslug[1-9][0-9]*$') then
teamslugs[paramno] = v
end
end
end
end
for i = 1, maxparam do
if xcs[i] then
turls[i] = 'https://xc.tfrrs.org/athletes/'
else
turls[i] = 'https://www.tfrrs.org/athletes/'
end
turls[i] = turls[i] .. ids[i]
if nameslugs[i] and teamslugs[i] then
turls[i] = turls[i] .. '/' .. teamslugs[i] .. '/' .. nameslugs[i] .. '.html'
end
if labels[i] then
turls[i] = turls[i] .. ' ' .. labels[i]
end
end
if maxparam == 0 then
local entity = mw.wikibase.getEntityObject() or {}
local claims = entity.claims or {}
local hasProp = claims["P5120"]
local category = ''
if not hasProp then
if mw.title.getCurrentTitle().namespace == 0 then
category = '[[Category:TFRRS template missing ID]]'
end
return '<span class="error">{{[[Template:TFRRS|TFRRS]]}} template missing ID.</span>' .. category
else
if mw.title.getCurrentTitle().namespace == 0 then
category = '[[Category:TFRRS template using Wikidata]]'
end
return '[https://www.tfrrs.org/athletes/' .. hasProp[1].mainsnak.datavalue.value .. ' ' .. f['name'] .. '] at <abbr title="Track & Field Results Reporting System">TFRRS</abbr> [[File:OOjs UI icon edit-ltr-progressive.svg |frameless |text-top |10px |alt=Edit this at Wikidata |link=https://www.wikidata.org/wiki/' .. entity.id .. '#P5120|Edit this at Wikidata]]' .. category
end
elseif maxparam == 1 then
return '[' .. turls[1] .. ' ' .. f['name'] .. '] at <abbr title="Track & Field Results Reporting System">TFRRS</abbr>'
else
for i = 1, maxparam do
turls[i] = '[' .. turls[i] .. ']'
end
end
local prefix = '\'\'\'' .. f['name'] .. '\'\'\' at <abbr title="Track & Field Results Reporting System">TFRRS</abbr>: '
return prefix .. table.concat(turls, ', ')
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.