p =
local P_POINTINTIME = 'P585'local P_PARTICIPANTOF = 'P1344'local P_SPORTSDISCIPLINE = 'P2416'local P_COUNTRY = 'P17'local P_PARTOF = 'P361'local P_RANKING = 'P1352'
local P_RACETIME = 'P2781'local P_POINTS = 'P1358'local P_DISTANCE = 'P2043'local marks =
p.athleticsResults = function(frame) local qid = frame.args[1] local yearArg = frame.args[2] local ent = mw.wikibase.getEntity(qid) local participantOfClaims = ent['claims'][P_PARTICIPANTOF] local output = output = output .. '|-\n' output = output .. '|colspan=11 style="text-align:center; margin:0; padding:0;"|\n' output = output .. '
2001\n' for i, pc in ipairs(participantOfClaims) 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) if year yearArg then local markProperty = nil for j, pm in ipairs(marks) do if pc['qualifiers'][pm] then markProperty = pm end end local mark = mw.wikibase.renderSnak(pc['qualifiers'][markProperty][1]):match('([^±]*)') --local meetname = mw.wikibase.renderSnak(pc['mainsnak']) output = output .. ' | -\n' output = output .. ' | ' .. fulldate:sub(7, 11) local meetname = mw.wikibase.renderSnak(pc['qualifiers'][P_PARTOF][1]) output = output .. ' | ' .. meetname local country = mw.wikibase.renderSnak(pc['qualifiers'][P_COUNTRY][1]) output = output .. ' | ' .. country output = output .. ' | ' .. 'F' local discipline = mw.wikibase.renderSnak(pc['qualifiers'][P_SPORTSDISCIPLINE][1]) output = output .. ' | ' .. discipline output = output .. ' | ' .. 'SF2' local ranking = 'NR' if pc['qualifiers'][P_RANKING] then ranking = pc['qualifiers'][P_RANKING][1]['datavalue']['value']['amount']:sub(2) end output = output .. ' | ' .. ranking output = output .. ' | ' .. mark output = output .. ' | ' .. '0.0' output = output .. '\n' end end end return outputendreturn p |
---|