Bu modul uchun Modul:grc-link/data/doc nomli hujjat sahifasini yaratishingiz mumkin

local make_auto_subtabler = require("Module:auto-subtable")

local content = mw.title.new("Appendix:Ancient Greek endings"):getContent()

local endings = {}

-- Find entries for endings marked by the syntax "; [[...]]".
-- Store them in a table.
for anchor in content:gmatch("\n; %[%[([^%]]+)%]%]") do
	if anchor:find("[\128-\255]") then
		for suffix in anchor:gmatch("%-[^%s,]+") do
			endings[suffix] = true
		end
	end
end

local shares_ending = make_auto_subtabler()

-- The actual purpose of this data module:
-- Check if each ending ends with the characters of any smaller endings, by
-- snipping off progressively larger pieces of the ending and comparing them to
-- all other endings.
-- If so, store the ending in an array indexed by the shorter ending.
-- For instance, -εσθαι ends with the characters of -αι and -σθαι.
for ending in pairs(endings) do
	for i = 1, mw.ustring.len(ending) - 2 do -- Ignore the first two characters because of the hyphen.
		local sub_ending = "-" .. mw.ustring.sub(ending, -i)
		if endings[sub_ending] then
			table.insert(shares_ending[sub_ending], ending)
		end
	end
end

shares_ending:un_auto_subtable()

return { shares_ending = shares_ending }