وحدة:ملعب/Mr. Ibrahem/1
< وحدة:ملعب | Mr. Ibrahem
توثيق الوحدة[أنشئ] [محو الاختزان][استخدامات] [قوالب]
-- This is the code to insert a template to indicate that the link is in English:
-- frame:expandTemplate{ title = "LANGUAGETEMPLATENAME", args = { "en" } }
-- It is obviously not used in the English Wikipedia itself.
local function linktext(s)
entity = mw.wikibase.getEntityObject()
if not entity then
label = mw.title.getCurrentTitle().text
else
label = mw.wikibase.label(entity.math) or mw.title.getCurrentTitle().text
end
if (s == nil) or (s == "") then
-- This text returns an error that says that the Sports Reference ID is neither
-- present on Wikidata nor in the article, and categorises the page as missing
-- the Wikidata property.
return ""
else
-- This is the text that is returned if there is a Sports Reference ID on Wikidata or in the article.
return mw.text.tag(''.. ce ..'', {}, '' .. s .. '')
end
end
local p = {}
function p.label1(frame)
local entity = frame.args[1]
local lang = frame.args['lang']
local dee = entity:getLabel(lang)
if dee then return dee
else return 'haaa'
end
end
function p.label2(frame)
local entity = mw.wikibase.getEntityObject(frame.args[1])
local lang = frame.args['lang']
local dee = entity:getLabel(lang)
if dee then return dee
else return 'haaa'
end
end
function p.label(frame)
local entity = mw.wikibase.getEntityObject(frame.args[1])
local arabic = entity:getLabel( 'ar' )
local english = entity:getLabel( 'en' )
if arabic == english then
return 'daa' else return arabic end
end
function p.P274(frame)
-- This is a check to see if the optional first parameter contains ".html". If it does, remove it.
ce = 'ce'
math = frame.args[1]
if not mw.wikibase then
return linktext(math)
end
local entity = mw.wikibase.getEntityObject()
if not entity then
return linktext(math)
end
local claims = entity.claims or {}
local hasProp = claims['P274']
local propValue = hasProp[1].mainsnak.datavalue.value
if not math then
return linktext(propValue)
end
end
function p.P2534(frame)
-- This is a check to see if the optional first parameter contains ".html". If it does, remove it.
ce = 'math'
math = frame.args[1]
if not mw.wikibase then
return linktext(math)
end
local entity = mw.wikibase.getEntityObject()
if not entity then
return linktext(math)
end
local claims = entity.claims or {}
local hasProp = claims["P2534"]
if not hasProp then
-- Category for articles that don't have the Sports Reference property on Wikidata.
return linktext(math)
end
local propValue = hasProp[1].mainsnak.datavalue.value
return linktext(propValue)
end
function p.S(frame)
ce = 'ref'
s = frame.args[1]
if s then
return linktext(s)
end
end
function p.e(frame)
timestamp = frame.args[1]
if timestamp then
return tonumber(string.sub(timestamp, 2, 5))
end
end
function p.getTitle(frame)
return frame:getTitle()
end
return p