Module:akk-sign values

local export = {}

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

function split(source, sep) local result, i = {}, 1 while true do		local a, b = string.find(source, sep) if not a then break end local candidat = string.sub(source, 1, a - 1) if candidat ~= "" then result[i] = candidat end i = i + 1 source = string.sub(source, b + 1) end if source ~= "" then result[i] = source end return result end

function export.create_list(args) local list = split(args, ",")

local output = {}

require("Module:collation").sort(list, lang, nil)

table.insert(output, table.concat(list, ", "))

return table.concat(output) end

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

local params = { [1] = {},		[2] = {}	}

local args = require("Module:parameters").process(parent_args, params) local pagename = m_links.full_link({ term = mw.title.getCurrentTitle.text, lang = lang })

local template = [===[		{| class="wikitable" style="max-width: 25em;" |- style="text-align:center;" ! Sign | {pagename} |- style="text-align:center;" ! Sumerograms | {sum} |- style="text-align:center;" ! Phonetic values | {phon} |-		|{\cl}]===]

local forms = {}

if args[1] ~= nil then forms["sum"] = export.create_list(args[1]) else forms["sum"] = "—" end

if args[2] ~= nil then forms["phon"] = export.create_list(args[2]) else forms["phon"] = "—" end

forms["pagename"] = pagename

return m_strutils.format(template, forms) end

return export