মডিউল:স্পোর্টসরেফারেন্স
মডিউল নথি[তৈরি করুন]
আপনি চাইলে এই স্ক্রিবুন্তো মডিউলের জন্য একটি নথির পাতা তৈরি করতে পারেন (তৈরি করুন) সম্পাদনাকারীগণ খেলাঘর (তৈরি করুন | আয়না) এবং পরীক্ষা পাতায় (তৈরি করুন) এই মডিউল সংক্রান্ত পরীক্ষা-নিরীক্ষা করতে পারেন। দয়া করে /নথি উপপাতায় বিষয়শ্রেণী যোগ করুন। এই মডিউলের উপপাতাসমূহ। |
-- 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.id) 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 "<span class='error'>উইকিউপাত্ত বা এই নিবন্ধে কোথাও স্পোর্টস রেফারেন্স ID উপস্থিত নেই!</span> \
[[টেমপ্লেট:স্পোর্টস-রেফারেন্স#উইকিউপাত্তে আইডি যোগ করা|আমি কীভাবে এটি ঠিক করতে পারি?]]\
[[বিষয়শ্রেণী:উইকিউপাত্তে স্পোর্টস রেফারেন্স নেই]]"
else
-- This is the text that is returned if there is a Sports Reference ID on Wikidata or in the article.
return "[[স্পোর্টস রেফারেন্স|স্পোর্টস রেফারেন্সে]] [http://www.sports-reference.com/olympics/athletes/" .. s .. ".html " .. label .. "]"
end
end
local p = {}
function p.link(frame)
-- This is a check to see if the optional first parameter contains ".html". If it does, remove it.
id = string.gsub((frame.args[1] or ""), ".html", "")
if not mw.wikibase then
return linktext(id)
end
local entity = mw.wikibase.getEntityObject()
if not entity then
-- This is the place to insert a category for articles that don't have items in Wikidata.
-- enwiki doesn't seem to have such a category, so in this case it is empty.
-- For other wikis, just remove the two comment dashes and insert the correct category name.
return linktext(id) -- .. "[[বিষয়শ্রেণী:উইকিউপাত্ত আইটেমহীন নিবন্ধ]]"
end
local claims = entity.claims or {}
local hasProp = claims["P1447"]
if not hasProp then
-- Category for articles that don't have the Sports Reference property on Wikidata.
return linktext(id) .. "[[বিষয়শ্রেণী:উইকিউপাত্তে স্পোর্টস রেফারেন্স নেই]]"
end
local propValue = hasProp[1].mainsnak.datavalue.value
return linktext(propValue)
end
return p