Open main menu

Module sandbox for tests. The main function is show.

If you want to keep your test module as private, please create page in format: Module:User:(username)/(module_name).



local export = {}

function export.show(frame)
	local Array = require "Module:array"
	
	local all_languages = require "Module:languages/alldata"
	local etymology_languages = require "Module:etymology languages/data"
	
	local function category_link(lang_code)
		local obj = require "Module:languages".getByCode(lang_code)
			or require "Module:etymology languages".getByCode(lang_code)
		return "[[:Category:" .. obj:getCategoryName() .. "|" .. obj:getCanonicalName() .. "]]"
	end
	
	return require "Module:User:Erutuon/lang stuff/map":new(all_languages)
		:filter(
			function(data)
				return data.ancestors and #data.ancestors > 1
			end)
		:map(
			function(data, code)
				return ("%s (<code>%s</code>): %s"):format(
					category_link(code),
					code,
					Array(data.ancestors)
						:map(
							function (code)
								return ("%s (<code>%s</code>)"):format(
									category_link(code),
									code)
							end)
						:concat ", ")
			end)
		:values()
		:sort()
		:concat "\n* "
end

return export