Module:User:ObnoxiousCoder/cuneiform spellings

Hello, you have come here looking for the meaning of the word Module:User:ObnoxiousCoder/cuneiform spellings. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:User:ObnoxiousCoder/cuneiform spellings, but we will also tell you about its etymology, its characteristics and you will know how to say Module:User:ObnoxiousCoder/cuneiform spellings in singular and plural. Everything you need to know about the word Module:User:ObnoxiousCoder/cuneiform spellings you have here. The definition of the word Module:User:ObnoxiousCoder/cuneiform spellings will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:User:ObnoxiousCoder/cuneiform spellings, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This is a private module sandbox of ObnoxiousCoder, for their own experimentation. Items in this module may be added and removed at ObnoxiousCoder's discretion; do not rely on this module's stability.


local export = {}

local m_links = require("Module:links")
local lang = require("Module:languages").getByCode("akk")
local m_table = require("Module:table")
local m_strutils = require("Module:string utilities")

local function format_list_items(items)
	local result = {}

	for _, item in ipairs(items) do
		if type(item) == "table" then
			local link = m_links.full_link(item.term)
			if item.q then
				link = link .. " " .. require("Module:qualifier").format_qualifier(item.q)
			end
			item = link
		elseif lang and not string.find(item, "<span") then
			item = m_links.full_link {lang = lang, term = item}
		end

		table.insert(result, '\n ' .. item)
	end

	return table.concat(result)
end

function export.create_list(args)
	if type(args) ~= "table" then error("expected table, got " .. type(args)) end

	local output = {}

	table.insert(output, ])

	if args.alphabetize then
		local function keyfunc(item)
			if type(item) == "table" then item = item.term.term end
			item = item:gsub("<.->", "")
			return item
		end
		require("Module:collation").sort(args, lang, keyfunc)
	end
	table.insert(output, format_list_items(args))

	table.insert(output, '</div>')

	return table.concat(output)
end

local param_mods = {"t", "tr", "g", "q"}
local param_mod_set = m_table.listToSet(param_mods)

function export.parse_params(items)
	local iut
	for i, item in ipairs(items) do
		if item:find("<") and not item:find("^*<*") then
			if not iut then
				iut = require("Module:inflection utilities")
			end
			local run = iut.parse_balanced_segment_run(item, "<", ">")
			local termobj = {term = {}}
			termobj.term.lang = lang
			termobj.term.term = run

			for j = 2, #run - 1, 2 do
				if run ~= "" then
					parse_err("Extraneous text '" .. run .. "' after modifier")
				end
				local modtext = run:match("^<(.*)>$")
				if not modtext then
					parse_err("Internal error: Modifier '" .. modtext .. "' isn't surrounded by angle brackets")
				end
				local prefix, arg = modtext:match("^(+):(.*)$")
				if not prefix then
					parse_err("Modifier " .. run .. " lacks a prefix, should begin with one of '" .. table.concat(param_mods, ":', '") .. ":'")
				end
				if param_mod_set then
					local obj_to_set
					if prefix == "q" then
						obj_to_set = termobj
					else
						obj_to_set = termobj.term
					end
					if obj_to_set then
						parse_err("Modifier '" .. prefix .. "' occurs twice, second occurrence " .. run)
					end
					if prefix == "t" then
						termobj.term.gloss = arg
					elseif prefix == "g" then
						termobj.term.genders = mw.text.split(arg, ",")
					else
						obj_to_set = arg
					end
				else
					parse_err("Unrecognized prefix '" .. prefix .. "' in modifier " .. run)
				end
			end
			items = termobj
		end
	end
	return items
end

function export.display(frame)
	local parent_args = frame:getParent().args

	local params = {
		 = {list = true},
		 = {list = true},
		 = {list = true}
	}

	local args = require("Module:parameters").process(parent_args, params)

	local top = [===[
		{| class="inflection-table vsSwitcher autocollapsed" data-toggle-category="inflection" style="background:#FF; text-align:center; border: 0.5px solid #CCC;
        |+ style="text-align:left; white-space: nowrap;"| Cuneiform spellings
		|- style="text-align:left;"
        ]===]

    local headers = '|- class="vsHide"\n'
    local data = '|- class="vsHide"\n'

    if next(args) ~= nil then
        headers = headers .. [===[
			! style="background-color:#C9F4F4;" | Logograms
			]===]
        data = data .. [===[
			| style="background-color:#ffffff;" | {sum}
			]===]
    end
    if next(args) ~= nil then
        headers = headers .. [===[
			! style="background-color:#C9F4F4;" | Phonetic
			]===]
        data = data .. [===[
			| style="background-color:#ffffff;" | {phon}
			]===]
    end
    if next(args) ~= nil then
        headers = headers .. [===[
			! style="background-color:#C9F4F4;" | Mixed
			]===]
        data = data .. [===[
			| style="background-color:#ffffff;" | {mix}
			]===]
    end

    local template = top .. headers .. [===[
		|- valign="top"
		]===] .. data .. [===[
			|}]===]

	local forms = {}

	forms = export.create_list(export.parse_params(args))
	forms = export.create_list(export.parse_params(args))
	forms = export.create_list(export.parse_params(args))

	return m_strutils.format(template, forms)

end

return export