Difference between revisions 21306565 and 21306566 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)	if info.code then
		if info.sc then
			local basic = export.get_item(info, "basic")
			return "This category contains '''" .. basic .. "'''."
		else
			local description = export.get_item(info, "description")
			local edit = export.get_item(info, "edit")
			return (description or "") .. mw.getCurrentFrame():expandTemplate{title = "edit", args = {
"Template:" .. edit, type = "sup"}}
		end
	else
		local display_name = export.get_item(info, "display_name")
		local edit = export.get_item(info, "edit")
		return "Categories with " .. display_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
(contracted; show full)			return mw.getCurrentFrame():expandTemplate{title = TOC_template.text, args = {}}
		end
	end
	
	return nil
end

return export