মডিউল:নিবন্ধের ইতিহাস/বিষয়শ্রেণী
মডিউল নথি[তৈরি করুন]
আপনি চাইলে এই স্ক্রিবুন্তো মডিউলের জন্য একটি নথির পাতা তৈরি করতে পারেন (তৈরি করুন) সম্পাদনাকারীগণ খেলাঘর (তৈরি করুন | আয়না) এবং পরীক্ষা পাতায় (তৈরি করুন) এই মডিউল সংক্রান্ত পরীক্ষা-নিরীক্ষা করতে পারেন। দয়া করে /নথি উপপাতায় বিষয়শ্রেণী যোগ করুন। এই মডিউলের উপপাতাসমূহ। |
-------------------------------------------------------------------------------
-- Category class
-- This module makes a Category class for use in [[Module:Article history]].
-- It provides a unified interface for the creation of category links. With
-- this class, categories can passed between objects without concerns about
-- interoperability and still have their values and sort keys easily
-- accessible.
-------------------------------------------------------------------------------
local checkType = require('libraryUtil').checkType
local CATEGORY_NS_TEXT = mw.site.namespaces[14].name
local Category = {}
Category.__index = Category
function Category.new(category, sortKey)
checkType('Category.new', 1, category, 'string')
checkType('Category.new', 2, sortKey, 'string', true)
local obj = setmetatable({}, Category)
obj.category = category
obj.sortKey = sortKey
return obj
end
function Category:__tostring()
if self.sortKey then
return string.format(
'[[%s:%s|%s]]',
CATEGORY_NS_TEXT,
self.category,
self.sortKey
)
else
return string.format(
'[[%s:%s]]',
CATEGORY_NS_TEXT,
self.category
)
end
end
return Category