A modult a Modul:labels/analysis/doc lapon tudod dokumentálni

local export = {}

function export.printConflicts(frame)
	local m_labeldata = mw.loadData("Module:labels/data")
	
	local replacements = m_labeldata.replacements
	
	local output = {"; labels:"}
	
	local labels = {}
	
	for label, data in pairs(replacements.labels) do
		local lang, langCode
		if data.languages then
			langCode = data.languages[1]
			lang = require("Module:languages").getByCode(langCode)
		end
		
		local canonicalName
		if lang then
			canonicalName = lang.getCanonicalName()
		end
		
		table.insert(labels, label)
		
		if langCode or canonicalName then
			table.insert(output, " (")
		end
		
		if langCode then
			table.insert(output, "<code>" .. langCode .. "</code>")
		end
		
		if canonicalName then
			if langCode then
				table.insert(output, ", ")
			end
			
			table.insert(output, canonicalName)
		end
		
		if langCode or canonicalName then
			table.insert(output, ")")
		end
	end
	
	table.sort(labels)
	
	for _, label in ipairs(labels) do
		table.insert(output, "\n* " .. label)
	end
	
	return table.concat(output)
end

function export.printUnused(frame)
	local withoutLanguage = require("Module:array")()
	for label, data in pairs(require("Module:labels/data/subvarieties").labels) do
		if not data.language then
			table.insert(withoutLanguage, label)
		end
	end
	return withoutLanguage
		:map(
			function(label)
				return "* <code>" .. label .. "</code>"
			end)
		:concat("\n")
end

return export