Difference between revisions 21306554 and 21306555 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)		local edit = get_item(info, "edit")
		return "Categories with " .. name .. " in various specific languages." .. mw.getCurrentFrame():expandTemplate{title = "edit", args = {"Template:" .. edit, type = "sup"}}
	end
end

-- Show a list of subcategories.
function show_subcategory_list(info)

	if not info.code then
		return nil
	end
	
	local subcategories = {}
	
	for i = 1, 40 do
		local subcat = get_item(info, "sub" .. i)
		
		if subcat ~= "" then
			local subcat_name = get_item({code = info.code, label = subcat, sc = info.sc, template = info.template}, "basic")
			local subcat_page = mw.title.new("Category:" .. subcat_name)
(contracted; show full)			return mw.getCurrentFrame():expandTemplate{title = TOC_template.text, args = {}}
		end
	end
	
	return nil
end

return export