Line 38: |
Line 38: |
| local function getquals(statement,qualid) | | local function getquals(statement,qualid) |
| if statement.qualifiers and statement.qualifiers['P'..qualid] then | | if statement.qualifiers and statement.qualifiers['P'..qualid] then |
| + | -- TODO: Remove call to mw.wikibase |
| return mw.wikibase.renderSnak(statement.qualifiers['P'..qualid][1]) | | return mw.wikibase.renderSnak(statement.qualifiers['P'..qualid][1]) |
| else | | else |
Line 45: |
Line 46: |
| local ids = {} | | local ids = {} |
| if qid then | | if qid then |
| + | -- TODO: Remove call to mw.wikibase |
| for _, statement in ipairs(mw.wikibase.getBestStatements(qid,property)) do | | for _, statement in ipairs(mw.wikibase.getBestStatements(qid,property)) do |
| if statement.mainsnak.datavalue then | | if statement.mainsnak.datavalue then |
Line 135: |
Line 137: |
| if qid then | | if qid then |
| qid = 'Q'..mw.ustring.gsub(qid, '^[Qq]', '') | | qid = 'Q'..mw.ustring.gsub(qid, '^[Qq]', '') |
| + | -- TODO: Remove call to mw.wikibase |
| if mw.wikibase.isValidEntityId(qid) and mw.wikibase.entityExists(qid) then | | if mw.wikibase.isValidEntityId(qid) and mw.wikibase.entityExists(qid) then |
| return qid | | return qid |
Line 146: |
Line 149: |
| local qid,topic | | local qid,topic |
| if namespace == 0 then | | if namespace == 0 then |
− | qid = mw.wikibase.getEntityIdForCurrentPage() | + | qid = mw.ext.UnlinkedWikibase.getEntityId('enwiki') |
| end | | end |
| if qid then -- article is connected to Wikidata item | | if qid then -- article is connected to Wikidata item |
Line 155: |
Line 158: |
| qid = resolveQID(parentArgs.qid) -- check qid parameter if no wikidata item is connected | | qid = resolveQID(parentArgs.qid) -- check qid parameter if no wikidata item is connected |
| if qid then -- qid parameter is valid, set topic to display | | if qid then -- qid parameter is valid, set topic to display |
| + | -- TODO: Remove call to mw.wikibase |
| topic = mw.wikibase.getLabel(qid) | | topic = mw.wikibase.getLabel(qid) |
| if topic and (mw.ustring.lower(title.subpageText) == mw.ustring.lower(topic)) then -- suppress topic display if subpagename equals topic up to case change | | if topic and (mw.ustring.lower(title.subpageText) == mw.ustring.lower(topic)) then -- suppress topic display if subpagename equals topic up to case change |
Line 163: |
Line 167: |
| end | | end |
| end | | end |
| + | -- TODO: Remove call to mw.wikibase |
| if topic and mw.wikibase.getSitelink(qid) then -- make wikilink to article | | if topic and mw.wikibase.getSitelink(qid) then -- make wikilink to article |
| + | -- TODO: Remove call to mw.wikibase |
| topic = '[[' .. mw.wikibase.getSitelink(qid) .. '|' .. topic .. ']]' | | topic = '[[' .. mw.wikibase.getSitelink(qid) .. '|' .. topic .. ']]' |
| end | | end |
Line 325: |
Line 331: |
| sectname = config.sections[c].name | | sectname = config.sections[c].name |
| else -- section from additional qid | | else -- section from additional qid |
| + | -- TODO: Remove call to mw.wikibase |
| sectname = mw.wikibase.getLabel(qids[c-numsections]) .. pencil(qids[c-numsections]) | | sectname = mw.wikibase.getLabel(qids[c-numsections]) .. pencil(qids[c-numsections]) |
| end | | end |