Module:egy-utilities

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

The make_sortkey function replaces the letters used in Egyptian transliteration with arbitrary codepoints so that words appear with the alphabetization ꜣ j y ꜥ w b p f m n r h ḥ ḫ ẖ z s š q k g t ṯ d ḏ. It is used by Module:columns and templates such as {{der3}}, but not by categorization functions.


local export = {}

local sortkey_replacements = mw.loadData "Module:egy-utilities/data"

-- Replace Egyptian letters with a series of arbitrary codepoints that happen to
-- be in the right sequence.
function export.make_sortkey(text, lang, sc)
	text= mw.ustring.lower(text)
	text = mw.ustring.gsub(text, "", "")
	return mw.ustring.upper(mw.ustring.gsub(text, ".", sortkey_replacements))
end

function export.show_sort_order(frame)
	local output = {}
	
	local fun = require "Module:fun"
	
	for i, word in ipairs(frame.args) do
		output = word
	end
	
	local function link(word)
		return '<span class="Latn" lang="egy">]</span>'
	end
	
	local make_sortkey = fun.memoize(export.make_sortkey)
	
	table.sort(
		output,
		function(word1, word2)
			return make_sortkey(word1) < make_sortkey(word2)
		end)
	
	return table.concat(
		fun.map(
			function(word)
				return "* " .. link(word) .. " (<code>" .. make_sortkey(word) .. "</code>)"
			end,
			output),
		"\n")
end

function export.hieroforms(frame)
	local parent_args = frame:getParent().args
	local default_title = parent_args or mw.title.getCurrentTitle().text
	default_title = 'Alternative hieroglyphic writings of '
		.. require 'Module:script utilities'.tag_text(
			default_title, require 'Module:languages'.getByCode 'egy', nil, 'term', nil)
	local tabletitle = parent_args or default_title
	local text = '<div class="NavFrame" style="clear:both;display:inline-block;">\n<div class="NavHead" style="">' .. tabletitle .. '&nbsp;&nbsp;</div>\n<div class="NavContent">\n{| style="text-align:center;"'
	local i = 1
	while parent_args do
        local new_frame = frame:newChild{title = frame:getTitle(), args = { = parent_args}}
        local hiero = require 'Module:egy-hieroglyphs'.parameter_to_hiero(new_frame)
		text = text .. '\n| style="background-color:#efefef"|<span style="margin:0px 6px;">' .. hiero .. '</span>'
		i = i + 1
	end
	local j = 1
	local no_read = true
	local since_last = 1
	local read = 'read1'
	while j < i do
		if parent_args then
			if no_read then
				text = text .. '\n|-'
				no_read = false
			end
			while since_last > 0 do
				text = text .. '\n|'
				since_last = since_last - 1
			end
			local link = require 'Module:links'.full_link( {
				lang = require 'Module:languages'.getByCode 'egy', term = parent_args
			}, 'term' )
			text = text .. 'style="background-color:#efefef"|' .. link
		end
		since_last = since_last + 1
		j = j + 1
		read = 'read' .. j
	end
	j = 1
	local no_date = true
	since_last = 1
	local date = 'date1'
	while j < i do
		if parent_args then
			if no_date then
				text = text .. '\n|-'
				no_date = false
			end
			while since_last > 0 do
				text = text .. '\n|'
				since_last = since_last - 1
			end
			text = text .. 'style="background-color:#efefef"|' .. frame:expandTemplate{title = 'defdate', args = {parent_args}}
		end
		since_last = since_last + 1
		j = j + 1
		date = 'date' .. j
	end
	j = 1
	local no_note = true
	since_last = 1
	local since_note = 1
	local note = 'note1'
	while j < i do
		if parent_args then
			if no_note then
				text = text .. '\n|- style="font-size:70%"'
				no_note = false
			end
			while since_last > 0 do
				text = text .. '\n|'
				since_last = since_last - 1
			end
			text = text .. 'style="background-color:#efefef"|' .. parent_args
		end
		since_last = since_last + 1
		j = j + 1
		note = 'note' .. j
	end
	text = text .. '\n|}</div></div>'
	return text
end

return export