Module:Official website: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 26: Line 26:
end
end
end
end
-- Finds whether a Wikidata property is qualified as being in English.
local function isEnglish(prop)
local ret = quickPcall(function ()
for i, lang in ipairs(prop.qualifiers.P407) do
if lang.datavalue.value['numeric-id'] == 1860 then
return true
end
end
return false
end)
return ret == true
end
-- Fetches the official website URL from Wikidata.
local fetchWikidataUrl
fetchWikidataUrl = function()
-- Get objects for all official sites on Wikidata.
local websites = quickPcall(function ()
return mw.wikibase.getEntityObject().claims.P856
end)
-- Clone the objects in case other code needs them in their original order.
-- Clone the objects in case other code needs them in their original order.
websites = websites and mw.clone(websites) or {}
websites = websites and mw.clone(websites) or {}
Line 81: Line 59:
return url
return url
end
end
return url
end
-- Render the tracking category.
-- Render the tracking category.
local function renderTrackingCategory(url, wikidataurl)
local function renderTrackingCategory(url, wikidataurl)