• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Difference between revisions of "Module:CategoryTree"

From Kancolle Wiki
Jump to navigation Jump to search
com>IloveSuiseiseki
m (7 revisions imported)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
local BaseData = require('Module:BaseData')
 
local BaseData = require('Module:BaseData')
  
local format = require('Module:Utils').format
+
local format = require('Module:Core').format
  
 
local CategoryTree = BaseData{
 
local CategoryTree = BaseData{
Line 24: Line 24:
  
 
function CategoryTree:_tostring()
 
function CategoryTree:_tostring()
return (mw.getCurrentFrame() or require('Module:ConsoleFrame')):preprocess(format(self._template, self))
+
return mw.getCurrentFrame():preprocess(format(self._template, self))
 
end
 
end
  
 
return CategoryTree
 
return CategoryTree

Latest revision as of 12:43, 12 May 2021

Documentation for this module may be created at Module:CategoryTree/doc

local BaseData = require('Module:BaseData')

local format = require('Module:Core').format

local CategoryTree = BaseData{
	_template = '<categorytree mode=${mode} depth=${depth}>${category}</categorytree>',
}

function CategoryTree:create(data)
	data = data or {}
	data.mode = data.mode or "pages"
	data.depth = data.depth or "0"
	data.__tostring = self._tostring
	return self.__index.create(self, data)
end

function CategoryTree:set_mode(mode)
	self._mode = mode
end

function CategoryTree:set_depth(depth)
    self._depth = depth
end

function CategoryTree:_tostring()
	return mw.getCurrentFrame():preprocess(format(self._template, self))
end

return CategoryTree