Module:User:Erutuon/06

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

Lua error at line 121: invalid value (nil) at index 1 in table for 'concat'


local export = {}

local U = mw.ustring.char
local get_codepoint = mw.ustring.codepoint
local gsub = mw.ustring.gsub

local is_combining = require("Module:Unicode data").is_combining
local map = require("Module:fun").map

local function codepoint_repr(number)
	return ("U+%X"):format(number)
end

local function show_codepoint(codepoint)
	return ("{0x%X}"):format(codepoint)
end

local function fill_array(lower, higher)
	local array = {}
	local array_i = 1
	for i = lower, higher do
		array = i
		array_i = array_i + 1
	end
	return array
end

local function HTML_entity(codepoint)
	return ("&#x%x;"):format(codepoint)
end

local function add_dotted_circle(HTML_entities)
	return (gsub(HTML_entities,
		"(&#x(%x+);)",
		function(entity, codepoint)
			if is_combining(tonumber(codepoint, 16)) then
				return "◌" .. entity
			else
				return entity
			end
		end))
end

local function expand_range(start, ending)
	local lower, higher = get_codepoint(start), get_codepoint(ending)
	if higher < lower then
		return ""
		--[[
		error('The range ' .. start .. "-" .. ending ..
			'(' .. codepoint_repr(lower) .. ',' .. codepoint_repr(higher) ..
			') is invalid.')
		]]
	end
	if higher - lower > 0x1FF then
		return table.concat(
			map(
				HTML_entity,
				fill_array(lower, lower + 0x1FF)))
			.. show_codepoint(lower + 0x200) .. "-" .. show_codepoint(higher)
	end
	return table.concat(map(HTML_entity,
		fill_array(lower, higher)))
end

local function interpret_ranges(str)
	return (gsub(str, "(.)%-(.)", expand_range))
end

function export.print_range(str, show_diacritics)
	if type(str) == "table" then
		local args = require("Module:parameters").process(str.args,
			{  = {}, dia = { type == "boolean" } })
		str = args
		show_diacritics = args.dia
	end
	
	if show_diacritics then
		return add_dotted_circle(interpret_ranges(str))
	else
		return interpret_ranges(str)
	end
end

function export.unescape(str, pattern)
	return (gsub(str,
		"{(+)}",
		function (codepoint)
			return U(tonumber(codepoint))
		end))
end

function export.escape(str, func)
	if not func then
		func = function(codepoint)
			return codepoint > 0x80
		end
	elseif type(func) ~= "function" then
		error("Escape expects a function or nil as its second argument, not " .. type(func) .. ".")
	end
	
	return (gsub(str,
		".",
		function (character)
			local codepoint = get_codepoint(character)
			if func(codepoint) then
				return show_codepoint(codepoint)
			else
				return character
			end
		end))
end

function export.show(frame)
	local output = {}
	local already_seen = {}
	for code, data in require("Module:table").sortedPairs(mw.loadData("Module:scripts/data")) do
		local characters = data.characters
		if characters and not already_seen then
			local range = export.print_range(characters, true)
			if range ~= '' then
				table.insert(output, table.concat{ data.canonicalName,
					': <span class="', code, '">',
					range,
					'</span>' })
			end
			already_seen = true
		end
	end
	return table.concat(output, "<br>")
end

return export