Module:ar-link

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

local U = require("Module:string/char")

-- Derived from Arabic data table in ].
local entry_name_replacements = {
	 = U(0x0627),  = "",  = "",  = "",
	 = "",  = "",  = "",  = "",
	 = "",  = "",  = "",
}

local function make_entry_name(text)
	return (text:gsub("*", entry_name_replacements))
end

local function link(entry, text)
	return '<span class="Arab" lang="ar">[['
		.. make_entry_name(entry)
		.. '#Arabic|' .. (text or entry) .. ']]</span>&lrm;'
end



function export.link(frame)
	local text = frame.args
	
	if not text then
		return nil
	end
	
	local transliterate = require("Module:memoize")(require "Module:ar-translit".tr)
	local open_paren = ' <span class="mention-gloss-paren annotation-paren">(</span><span class="tr Latn" xml:lang="ar-Latn" lang="ar-Latn">'
	local close_paren = '</span><span class="mention-gloss-paren annotation-paren">)</span>'
	
	return (text
		:gsub(
			"%]+)%]%]",
			function (link_text)
				local entry, text = link_text:match("^(+)|(.+)$")
				entry, text = entry or link_text, text or link_text
				local translit = transliterate(text)
				if translit then
					return link(entry, text)
						.. open_paren .. translit .. close_paren
				else
					return link(link_text)
				end
			end))
end

return export