Interested Article - Wikidata-redirect
aoibhe
- 2021-02-01
- 1
Для {{ Wikidata-redirect }}
local p = {}
function p.interwikiNumber(frame)
local sitelinks = frame:callParserFunction('#invoke', {'wikibase', 'struc', 'sitelinks'})
local _, res = mw.ustring.gsub(sitelinks, 'wiki', '')
return res / 2
end
function p.badges(frame)
local site = frame.args[1]
local id = frame.args[2]
if not site then return printError("site-not-found") end
local entity = mw.wikibase.getEntity(id)
if not entity then return printError("entity-not-found") end
local badges = entity.sitelinks[site].badges
if badges then
local result
for idx = 1, #badges do
if result then result = result .. "/" .. badges[idx] else result = badges[idx] end
end
return result
end
end
return p
aoibhe
- 2021-02-01
- 1