Difference between revisions 21306592 and 21306593 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)end

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

	if not ret then
		if item:find("^sortparent[1-9]$") or item == "sortparentumbrella" then
			ret = export.get_item(info, "display_name")
			require("Module:debug").track("category tree/no sortparentthen
		require("Module:debug").track("category tree/no sortparent")
		
		if not ret then
			ret = export.get_item(info, "display_name")
		end
	elseif item == "sortparentumbrella" then
		if not ret then
			ret = export.get_item(info, "display_name")
		end
	end
	
	return ret
end

-- Check the name of the current page, and return an error if it's not right.
(contracted; show full)			return mw.getCurrentFrame():expandTemplate{title = TOC_template.text, args = {}}
		end
	end
	
	return nil
end

return export