Difference between revisions 21306675 and 21306676 on frwiktionary

local export = {}
local m_languages = require('Module:languages')

-- 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.)"
(contracted; show full)		table.insert(categories, "[[Category:Empty categories]]")
	end
	
	if current:isHidden() then
		table.insert(categories, "__HIDDENCAT__")
	end
	
	table.insert(boxes, show_catfix(
infocurrent))
	table.insert(boxes, show_editlink(current))
	table.insert(boxes, show_pagelist(info))
	
	-- Generate the displayed information
	table.insert(display, show_breadcrumbs(current))
	table.insert(display, show_description(current))
	table.insert(display, show_children(current))
(contracted; show full)	if errortext then
		return (category or "") .. show_error(errortext)
	else
		return nil
	end
end

function show_catfix(
info)
	local code = info.code
	
	if not code then
		return nil
	end
	
	local lang = require("Module:languages").getByCode(code)
	
	if not current)
	if not current._lang  then
		return nil
	end
	
	return
		"<span id=\"catfix\" style=\"display:none;\" class=\"CATFIX-" .. mw.uri.anchorEncode(current._lang:getCanonicalName()) .. "\">" ..
		require("Module:script utilities").tag_text("&nbsp;", lang, (sc and require("Module:scripts").getByCode(info.sc) or nil), nil) ..
		"</span>"
end

-- Show the parent categories that the current category should be placed in.
function show_categories(current, categories)
	local parents = current:getParents()
(contracted; show full)			return mw.getCurrentFrame():expandTemplate{title = TOC_template.text, args = {}}
		end
	end
	
	return nil
end

return export