Modul:es-conj/generate documentation

A modult a Modul:es-conj/generate documentation/doc lapon tudod dokumentálni

local paradigms = require('Module:es-conj/data/paradigms')
local es_conj = require('Module:es-conj')

local export = {}

function export.list_paradigms(frame)
	local ending = frame.args['ending']
	frame.args["summarize"] = true
	
	local result = {}
	
	for k,v in pairs(paradigms[ending]) do
		local subpage = "Module:es-conj/data/" .. ending .. '/' .. k
		local tests_link = subpage .. "/testcases"
		local success, tests_module = pcall(require, tests_link)
		local tests, line
		if success then
			tests = tests_module.run_tests(frame)
			table.insert(
				result,
				"[[" .. subpage .. "|" .. k .. "]] <small>(" .. tests .. ", [[" .. tests_link .. "|tests]])</small>"
			)
		else
			table.insert(result, "testcases for [[" .. subpage .. "|" .. k .. "]] not found")
		end
	end
	
	local ending_subpage = "Module:es-conj/data/" .. ending
	local ending_subpage_tests_link = ending_subpage .. "/testcases"
	local ending_subpage_tests = require(ending_subpage_tests_link).run_tests(frame)
	return "'''[[" .. ending_subpage .. "|" .. ending .. "]] <small>(" .. ending_subpage_tests .. ", [[" .. ending_subpage_tests_link .. "|tests]])</small>" ..  "''': \n* " .. table.concat(result, "\n* ")
	
end

function export.list_paradigms_without_tests(frame)
	local ending = frame.args['ending']
	local result = {}
	
	for k,v in pairs(paradigms[ending]) do
		local subpage = "Module:es-conj/data/" .. ending .. '/' .. k
		local line = "[[" .. subpage .. "|" .. k .. "]]"
		table.insert(result, line)
	end

	return '** ' .. table.concat(result, "\n** "	)
		
end

function export.show_table_with_numbers(frame)
	frame.args[1] = 'example_pattern'
	frame.args[2] = 'example_pattern'
	
	return es_conj.verb_table(frame)
	
end


return export