Difference between revisions 21306600 and 21306601 on frwiktionary

local export = {}

-- The main entry point.
-- This is the only function that can be invoked from a template.
function export.show(frame)
	if mw.title.getCurrentTitle().nsText == "Template" then
		return "(This template should be used on pages in the Category: namespace.)"
	elseif mw.title.getCurrentTitle().nsText ~= "Category" then
(contracted; show full)	
	return table.concat(categories, "") .. table.concat(display, "\n\n") .. "<br clear=\"all\"/>"
end

-- Retrieves an item of information
function export.get_item(info, item)
	local submodule = require("Module:category tree/" .. info.template)
	

	if item == "label_exists" then
	elseif item == "parents" then
	elseif item == "display_name" then
	elseif item == "basic" then
	elseif item == "umbrella" then
	elseif itemlocal ret = nil
	
	local functions = {
		["label_exists"] = "exists",
		["parents"] = "getParentLabels",
		["display_name"] = "getBreadcrumbName",
		["edit"] = "getEditTarget",
		
		["basic"] = "getBasicName",
		["description"] = "getBasicDescription",
		
		["umbrella"] = "getUmbrellaName",
		["description_description"] == "fundamental" then
	elseif item == "sortparentumbrella" then
	elseif item == "description" then
	elseif itemgetUmbrellaDescription",
		["sortparentumbrella"] = "getUmbrellaSortKey",
		["umbrella-categorization"] == "ugetUmbrella_description" then
	elseif item:find("^sub[1-9][0-9]?$") then
	elseif item == "umbrella-categorization" then
	elseif item == "edit" thCategorizationType",
		
		["fundamental"] = "getFundamentalName",
	}
	
	if item:find("^sub[1-9][0-9]?$") then
		return submodule.get_item(info, item)
	elseif functions[item] then
		if submodule[functions[item]] then
			return submodule[functions[item]](info)
		else
			require("Module:debug").track("category tree/get item")
			require("Module:debug").track("category tree/get item/" .. item)
			return submodule.get_item(info, item)
		end
	else
		error("The requested data item \"" .. item .. "\" is not recognized.")
	end
	
	return submodule.get_item(info, item)
end

-- Check the name of the current page, and return an error if it's not right.
function check_name(info)
	local errortext = nil
	local category = nil
	
	if not export.get_item(info, "label_exists") then
(contracted; show full)			return mw.getCurrentFrame():expandTemplate{title = TOC_template.text, args = {}}
		end
	end
	
	return nil
end

return export