Module:language-like: Difference between revisions

No edit summary
No edit summary
Tag: Manual revert
 
(5 intermediate revisions by the same user not shown)
Line 4: Line 4:
local table_module = "Module:table"
local table_module = "Module:table"


local wikibase = mw.wikibase
--local wikibase = mw.wikibase


local category_name_has_suffix -- defined as export.categoryNameHasSuffix below
local category_name_has_suffix -- defined as export.categoryNameHasSuffix below
local get_entity = wikibase.getEntity
--local get_entity = wikibase.getEntity
local get_entity_id_for_title = wikibase.getEntityIdForTitle
--local get_entity_id_for_title = wikibase.getEntityIdForTitle
local gsub = string.gsub
local gsub = string.gsub
local ipairs = ipairs
local ipairs = ipairs
local match = string.match
local match = string.match
local select = select
local select = select
local sitelink = wikibase.sitelink
--local sitelink = wikibase.sitelink
local type = type
local type = type
local umatch = mw.ustring.match
local umatch = mw.ustring.match
Line 190: Line 190:
-- Otherwise, check the Wikidata item for a sitelink.
-- Otherwise, check the Wikidata item for a sitelink.
local item = self:getWikidataItem()
local item = self:getWikidataItem()
article = item and sitelink(item, project) or false
article = self:getCanonicalName() or false --item and sitelink(item, project) or false
if article then
if article then
return article
return article
Line 256: Line 256:
local function get_commons_cat_sitelink(item)
local function get_commons_cat_sitelink(item)
if item then
--[[if item then
local commons_sitelink = sitelink(item, "commonswiki")
local commons_sitelink = sitelink(item, "commonswiki")
-- Reject any sitelinks that aren't categories.
-- Reject any sitelinks that aren't categories.
return commons_sitelink and match(commons_sitelink, "^Category:") and commons_sitelink or nil
return commons_sitelink and match(commons_sitelink, "^Category:") and commons_sitelink or nil
end
end]]
return nil
end
end