Module:Sandbox/Cabayi
Appearance
local p = {}
p.hansard = function(frame)
-- get from wikidata
local entity = mw.wikibase.getEntityObject()
local rettxt = ""
local hansardcurr = 4068 -- use Harrington for now...
for i = 1, 3 do -- at most 3 parliaments to date (2016)
if entity['claims']["P463"][i] == nil then
break -- no parliament found
end
local parlid = entity['claims']["P463"][i]["mainsnak"]["datavalue"]["value"]["numeric-id"]
-- |P463|1|mainsnak|datavalue|value|numeric-id
if parlid == nil then
break -- no parliament found
elseif parlid == 21084471 then
-- 2005-10
rettxt = rettxt .. "\n* Contributions in [[List of MPs elected in the United Kingdom general election, 2005|the 2005–10 Parliament]] at ''[[Hansard]]'' {{*}} [http://www.publications.parliament.uk/pa/cm200607/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .. "_od.html 06-07] {{*}} [http://www.publications.parliament.uk/pa/cm200708/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .. "_od.html 07-08] {{*}} [http://www.publications.parliament.uk/pa/cm200809/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .. "_od.html 08-09] {{*}} [http://www.publications.parliament.uk/pa/cm200910/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .."_od.html 09-10]"
elseif parlid == 21084472 then
-- 2010-15
rettxt = rettxt .. "\n* Contributions in [[List of MPs elected in the United Kingdom general election, 2010|the 2010–15 Parliament]] at ''[[Hansard]]'' {{*}} [http://www.publications.parliament.uk/pa/cm201011/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .. "_od.html 10-12(1)] {{*}} [http://www.publications.parliament.uk/pa/cm201212/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .. "_od.html 10-12(2)] {{*}} [http://www.publications.parliament.uk/pa/cm201213/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .. "_od.html 12-13] {{*}} [http://www.publications.parliament.uk/pa/cm201314/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .. "_od.html 13-14] {{*}} [http://www.publications.parliament.uk/pa/cm201415/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .. "_od.html 14-15]"
elseif parlid == 21084473 then
-- 2015-20
rettxt = rettxt .. "\n* Contributions in [[List of MPs elected in the United Kingdom general election, 2015|the 2015–20 Parliament]] at ''[[Hansard]]'' {{*}} [http://www.publications.parliament.uk/pa/cm201516/cmhansrd/cmallfiles/mps/commons_hansard_" .. hansardcurr .. "_od.html 15-16]"
else
-- meh
end
end
return rettxt .."\n"
end
return p