Module:Wd: Difference between revisions

121 bytes added ,  22 December 2023
Per edit request
m (1 revision imported)
(Per edit request)
Line 65: Line 65:
eid  = "eid",
eid  = "eid",
page = "page",
page = "page",
date = "date"
date = "date",
globalSiteId = "globalSiteId"
}
}


Line 2,201: Line 2,202:
end
end


local function getEntityId(arg, eid, page, allowOmitPropPrefix)
local function getEntityId(arg, eid, page, allowOmitPropPrefix, globalSiteId)
local id = nil
local id = nil
local prop = nil
local prop = nil
Line 2,232: Line 2,233:
end
end


id = mw.wikibase.getEntityIdForTitle(page) or ""
id = mw.wikibase.getEntityIdForTitle(page, globalSiteId) or ""
end
end


Line 2,279: Line 2,280:


-- get the entity ID from either the positional argument, the eid argument or the page argument
-- get the entity ID from either the positional argument, the eid argument or the page argument
cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page])
cfg.entityID, cfg.propertyID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], false, args[p.args.globalSiteId])


if cfg.entityID == "" then
if cfg.entityID == "" then
Line 2,451: Line 2,452:


-- get the entity ID from either the positional argument, the eid argument or the page argument
-- get the entity ID from either the positional argument, the eid argument or the page argument
cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true)
cfg.entityID = getEntityId(lastArg, args[p.args.eid], args[p.args.page], true, args[p.args.globalSiteId])


if cfg.entityID == "" or not mw.wikibase.entityExists(cfg.entityID) then
if cfg.entityID == "" or not mw.wikibase.entityExists(cfg.entityID) then
Anonymous user