p =
local P_POINTINTIME = 'P585'local P_PARTICIPANTOF = 'P1344'local P_SPORTSDISCIPLINE = 'P2416'
local P_RACETIME = 'P2781'local P_POINTS = 'P1358'local P_DISTANCE = 'P2043'local marks =
p.athleticsResults = function(frame) local qid = frame.args[1] local ent = mw.wikibase.getEntity(qid) local participantOfClaims = ent['claims'][P_PARTICIPANTOF] local years = local output = output = output .. '
Results for Usain Bolt\n' output = output .. ' | -\n' output = output .. '!scope="col" style="width:5%;" | Date! | Meeting | Location | Ctry. | Cat. | Event | H | Pl. | Perf. | W | N\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) local serialized = fulldate -- e.g. "+2017-06-28T00:00:00Z" 21 characters long if pc['qualifiers'][P_SPORTSDISCIPLINE] then serialized = serialized .. '\'\'\ .. mw.wikibase.renderSnak(pc['qualifiers'][P_SPORTSDISCIPLINE][1]) .. ':\'\'\' ' end local markProperty = nil for j, pm in ipairs(marks) do if pc['qualifiers'][pm] then markProperty = pm end end if markProperty ~= nil then -- mw.logObject(pc['qualifiers'][markProperty]) serialized = serialized .. mw.wikibase.renderSnak(pc['qualifiers'][markProperty][1]):match('([^±]*)') end meetname = mw.wikibase.renderSnak(pc['mainsnak']) if meetname ~= 'no value' then serialized = serialized .. ' at ' .. meetname .. '' end if not years[year] then years[year] = end table.insert(years[year], serialized) end end yearsort = for n in pairs(years) do table.insert(yearsort, n) end table.sort(yearsort) for i, year in ipairs(yearsort) do --results = years[year] --ressort = --for k, v in pairs(results) do table.insert(ressort, v) end --table.sort(ressort) output = output .. ' | -\n' output = output .. ' | \n' output = output .. '
|
---|