p =
local P_PERSONALBEST = 'P2415'local P_POINTINTIME = 'P585'local P_SPORTSDISCIPLINE = 'P2416'local P_LOCATION = 'P276'local P_NUMBEROFPOINTS = 'P1351'
p.pbs = function(frame) local qid = frame.args[1] local ent = mw.wikibase.getEntity(qid) local pbClaims = ent['claims'][P_PERSONALBEST] local out = output = output .. '
PBs\n' for i, pc in ipairs(pbClaims) do mw.logObject(mw.wikibase.renderSnak(pc['mainsnak'])) if pc['qualifiers'] then local fulldate = pc['qualifiers'][P_POINTINTIME][1]['datavalue']['value']['time'] local year = fulldate:sub(2, 5) local mark = mw.wikibase.renderSnak(pc['mainsnak']['datavalue']['value']['amount']):match('([^±]*)') --local meetname = mw.wikibase.renderSnak(pc['mainsnak']) output = output .. ' | -\n' output = output .. ' | ' .. fulldate:sub(7, 11) local location = mw.wikibase.renderSnak(pc['qualifiers'][P_LOCATION][1]) output = output .. ' | ' .. location local discipline = mw.wikibase.renderSnak(pc['qualifiers'][P_SPORTSDISCIPLINE][1]) output = output .. ' | ' .. discipline local ranking = 'NR' if pc['qualifiers'][P_NUMBEROFPOINTS] then ranking = pc['qualifiers'][P_NUMBEROFPOINTS][1]['datavalue']['value']['amount']:sub(2) end output = output .. ' | ' .. ranking output = output .. ' | ' .. mark output = output .. '\n' end end return outputendreturn p |
---|