Modul:category tree/scriptcatboiler
Penampilan
- Modul ini kekurangan sublaman pendokumenan. Sila mencipta laman pendokumenan berkaitan.
- Pautan berguna: laman akar • sublaman • pautan • transklusi • kes ujian • kotak pasir
--Modul usang, telah diganti dengan Module:category tree/poscatboiler/data/scripts
--local export = {}
--local labels = require("Module:category tree/scriptcatboiler/data")
-- Category object
--local Category = {}
--Category.__index = Category
--function Category.new(info)
-- local self = setmetatable({}, Category)
-- assert(type(info) == "table", "The \"info\" parameter must be a table.")
-- self._info = {}
-- for key, val in pairs(info) do
-- if key == "code" then
-- self._info.code = val
-- self._sc = require("Module:scripts").getByCode(val) or error("The script code \"" .. val .. "\" is not valid.")
-- elseif key == "label" then
-- self._info.label = val
-- self._data = labels[self._info.label]
-- else
-- error("The parameter \"" .. key .. "\" was not recognized.")
-- end
-- end
-- Check if the label exists
-- if not self._info.label then
-- error("No label was specified.")
-- elseif not self._data then
-- return nil
-- end
-- if self._info.label == "ROOT" and not self._sc then
-- return nil
-- end
-- return self
--end
--export.new = Category.new
--function Category:getInfo()
-- return self._info
--end
--function Category:getBreadcrumbName()
-- if self._info.label == "ROOT" then
-- return self._sc:getCategoryName()
-- else
-- return self._info.label
-- end
--end
--function Category:getDataModule()
-- return "Module:category tree/scriptcatboiler/data"
--end
--function Category:canBeEmpty()
-- return self._info.label == "ROOT"
--end
--function Category:isHidden()
-- return self._data["hidden"] and self._info.code
--end
--function Category:getCategoryName()
-- if self._sc then
-- local ret = nil
-- if self._info.label ~= "ROOT" then
-- ret = " " .. self._info.label
-- end
-- return mw.getContentLanguage():ucfirst(self._sc:getCategoryName() .. (ret or ""))
-- else
-- return mw.getContentLanguage():ucfirst(self._info.label .. " by script")
-- end
--end
--function Category:getDescription()
-- if self._sc then
-- local ret = self._data["description"]
-- if ret then
-- if ret:find("{{{code}}}") then ret = ret:gsub("{{{code}}}", self._sc:getCode()) end
-- if ret:find("{{{scname}}}") then ret = ret:gsub("{{{scname}}}", self._sc:getCanonicalName()) end
-- if ret:find("{{{sccat}}}") then ret = ret:gsub("{{{sccat}}}", self._sc:getCategoryName()) end
--
-- if self._info.label == "ROOT" then
-- local systems = self._sc:getSystems()
-- if #systems > 0 then
-- ret = ret .. "\n\nThis script mainly belongs to the following systems: "
-- for i,system in ipairs(systems) do
-- if i ~= 1 then
-- ret = ret .. ", "
-- end
-- ret = ret .. systems[i]:getCanonicalName() .. "[[Category:" .. systems[i]:getCategoryName() .. "]]"
-- end
-- end
-- end
-- end
-- return ret
-- else
-- return "Categories with " .. self._info.label .. " of various specific scripts."
-- end
--end
--function Category:getParents()
-- if self._sc then
-- local parents = self._data["parents"]
-- if not parents or #parents == 0 then
-- return nil
-- end
-- local ret = {}
-- for key, parent in ipairs(parents) do
-- local parent = mw.clone(parent)
-- if type(parent) ~= "table" then
-- parent = {name = parent}
-- end
-- if not parent.sort then
-- parent.sort = self._info.label
-- end
-- parent.sort = parent.sort:gsub("{{{scname}}}", self._sc:getCanonicalName())
-- parent.sort = parent.sort:gsub("{{{sccat}}}", self._sc:getCategoryName())
-- if parent.name and parent.name:find("^Category:") then
-- parent.name = parent.name:gsub("{{{scname}}}", self._sc:getCanonicalName())
-- parent.name = parent.name:gsub("{{{sccat}}}", self._sc:getCategoryName())
-- else
-- local pinfo = mw.clone(self._info)
-- pinfo.label = parent.name
-- if parent.template then
-- parent.name = require("Module:category tree/" .. parent.template).new(pinfo)
-- else
-- parent.name = Category.new(pinfo)
-- end
-- end
-- table.insert(ret, parent)
-- end
-- return ret
-- else
-- if self._data["asas"] then
-- return {{name = "Kategori:" .. self._data["asas"], sort = self._data["sortparentumbrella"] or self._info.label}}
-- else
-- return nil
-- end
-- end
--end
--function Category:getChildren()
-- local children = self._data["children"]
-- if not self._sc or not children or #children == 0 then
-- return nil
-- end
-- local ret = {}
-- for _, child in ipairs(children) do
-- child = mw.clone(child)
-- if type(child) ~= "table" then
-- child = {name = child, sort = child}
-- end
-- local cinfo = mw.clone(self._info)
-- cinfo.label = child.name
-- child.name = Category.new(cinfo)
-- table.insert(ret, child)
-- end
-- return ret
--end
--function Category:getUmbrella()
-- if not self._sc then
-- return nil
-- end
-- local uinfo = mw.clone(self._info)
-- uinfo.code = nil
-- return Category.new(uinfo)
--end
--return export