Content deleted Content added
don't load internationalisation module for English Wikipedia |
m update to use new mw.wikibase API changes |
||
Line 321:
if parameter then
if parameter == "link" then
local linkTarget = mw.wikibase.
local linkName = mw.wikibase.
if linkTarget then
-- if there is a local Wikipedia article link to it using the label or the article title
Line 334:
end
else
return mw.wikibase.
end
end
Line 426:
if refparts then refparts = refparts .. ", " else refparts = "" end
-- output the label of the property of the reference part, e.g. "imported from" for P143
refparts = refparts .. tostring(mw.wikibase.
-- output all values of this reference part, e.g. "German Wikipedia" and "English Wikipedia" if the referenced claim was imported from both sites
for snakidx = 1, #snakval do
Line 446:
return false, input_parm, nil, nil
end
local entity = mw.wikibase.
local claims
if entity and entity.claims then
Line 471:
for k, v in pairs(claims) do
local qnumber = "Q" .. v.mainsnak.datavalue.value["numeric-id"]
local sitelink = mw.wikibase.
local label = labelHook(qnumber) or mw.wikibase.
if sitelink then
out[#out + 1] = "[[" .. sitelink .. "|" .. label .. "]]"
Line 504:
local id = frame.args[2]
-- return description of a Wikidata entity in the given language or the default language of this Wikipedia site
return mw.wikibase.
end
Line 511:
local id = frame.args[2]
-- return label of a Wikidata entity in the given language or the default language of this Wikipedia site
return mw.wikibase.
end
Line 584:
local input_parm = mw.text.trim(frame.args[3] or "")
if input_parm == "FETCH_WIKIDATA" then
local entity = mw.wikibase.
if entity.claims[propertyID] ~= nil then
local out = {}
Line 605:
local function outputValue(value)
local qnumber = "Q" .. value.datavalue.value["numeric-id"]
if (mw.wikibase.
return "[[" .. mw.wikibase.sitelink(qnumber) .. "]]"
else
Line 664:
local function outputHook(value)
if value.datavalue.value["numeric-id"] then
return mw.wikibase.
else
return value.datavalue.value
Line 744:
-- formatPropertyValues returns a table with the P1323 values concatenated with ", " so we have to split them out into a table in order to construct the return string
p.getTAValue = function(frame)
local ent = mw.wikibase.
local props = ent:formatPropertyValues('P1323')
local out = {}
Line 798:
local input_parm = mw.text.trim(frame.args[1] or "")
if input_parm == "FETCH_WIKIDATA" then
local ent = mw.wikibase.
local imgs
if ent and ent.claims then
Line 863:
-- returns the page id (Q...) of the current page or nothing of the page is not connected to Wikidata
function p.pageId(frame)
end
Line 879 ⟶ 878:
-- get wikidata entity
local entity = mw.wikibase.
if not entity then
if showerrors then return printError("entity-not-found") else return default end
Line 936 ⟶ 935:
id = nil
end
local data = mw.wikibase.
if not data then
return nil
Line 980 ⟶ 979:
function p.Dump(frame)
local f = (frame.args[1] or frame.args.id) and frame or frame:getParent()
local data = mw.wikibase.
if not data then
return i18n.warnDump
|