Changes

158 bytes added ,  05:37, 5 May 2023
no edit summary
Line 490: Line 490:  
local function makeWikidataCategories(qid)
 
local function makeWikidataCategories(qid)
 
local ret
 
local ret
local qid = qid or mw.wikibase.getEntityIdForCurrentPage()
+
local qid = qid or mw.ext.UnlinkedWikibase.getEntityId('enwiki')
 +
-- TODO: Remove call to mw.wikibase
 
if mw.wikibase and current_page.namespace == 0 then
 
if mw.wikibase and current_page.namespace == 0 then
 +
-- TODO: Remove call to mw.wikibase
 
if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, "P625") and mw.wikibase.getBestStatements(qid, "P625")[1] then
 
if qid and mw.wikibase.entityExists(qid) and mw.wikibase.getBestStatements(qid, "P625") and mw.wikibase.getBestStatements(qid, "P625")[1] then
 +
-- TODO: Remove call to mw.wikibase
 
local snaktype = mw.wikibase.getBestStatements(qid, "P625")[1].mainsnak.snaktype
 
local snaktype = mw.wikibase.getBestStatements(qid, "P625")[1].mainsnak.snaktype
 
if snaktype == 'value' then
 
if snaktype == 'value' then
Line 612: Line 615:  
if not tonumber(args[1]) and not args[2] then
 
if not tonumber(args[1]) and not args[2] then
 
args[3] = args[1]; args[1] = nil
 
args[3] = args[1]; args[1] = nil
 +
-- TODO: Remove call to mw.wikibase
 
local entity = mw.wikibase.getEntityObject(args.qid)
 
local entity = mw.wikibase.getEntityObject(args.qid)
 
if entity
 
if entity