Module:User:Babr/fa-l

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

FIXME:

1. (DONE) there should be a check to make sure the words on both sides of // are the same before replacing
2. (DONE) add support for \ as an escape character
3. instead of args, it should be possible to specify args and args (?)
4. (DONE) allow // to specify different transliterations (?)
5. add support for {} transliterations

]=]

local export = {}

local m_links = require("Module:links")
local m_string_utils = require("Module:string utilities")
local ugsub = m_string_utils.gsub
local match = m_string_utils.match
local upper = m_string_utils.upper
local U = m_string_utils.char
local get_translit = require("Module:fa-translit").tr
local romanize_ira = require('Module:fa-IPA').romanize_ira

--characters (annoying to type)
local fatHataan = U(0x64B)
local Dammataan = U(0x64C)
local kasrataan = U(0x64D)
local fatHa = U(0x64E)
local Damma = U(0x64F)
local kasra = U(0x650)
local shadda = U(0x651)
local sukuun = U(0x652)
local dagger_alif = U(0x670)
local alif_waSl = U(0x671)
local diacritics = "()"
local EOW = "()"
local POW = "(+)"
local hyphen = "<span class=\"Zsym mention\" style=\"font-size:85%;\">/</span>"

function export.link(data, options)
	options = options or {}
	data.lang = data.lang or require'Module:languages'.getByCode'fa'
	local term_for_rom = data.term
	data.term = ugsub(data.term, "\\//", "\1")
	data.term = ugsub(data.term, "\\%-", "\2")
	data.term = ugsub(data.term, "\\{", "\3")
	if data.tr ~= '-' then
		if not data.tr then
			data.tr = m_links.remove_links(get_translit(term_for_rom))
		else 
			data.tr = ugsub(data.tr, "\\//", "\1")
			data.tr = ugsub(data.tr, "\\{", "\3")
			if data.tr:match"" and not data.tr:match"\\" then
				error("Cannot generate the Iranian Persian romanization as the Classical Persian romanization was not provided.")
				else
				data.tr = ugsub(data.tr, "\\()", "%1")
				end
			if data.tr:match".+//.+" then
			cls_tr, ir_tr = match( data.tr , "(.*)//(.*)" )
			if cls_tr == ir_tr then
				data.tr = cls_tr
				else
			data.tr = cls_tr .. hyphen .. romanize_ira(ir_tr)
			end
		else 
			cls_tr = data.tr
			ir_tr = data.tr
			cls_tr = ugsub(cls_tr, "(" .. POW .. ")" .. "{" .. POW .. "}", "%1")
			ir_tr = ugsub(ir_tr, POW .. "{(" .. POW .. ")}", "%1")
			data.tr = data.tr .. hyphen .. romanize_ira(data.tr)
			data.tr = ugsub(data.tr, "\1", "//")
			data.tr = ugsub(data.tr, "\3", "{")
			end
			data.tr = ugsub(data.tr, "\1", "//")
			data.tr = ugsub(data.tr, "\3", "{")
		end end
	data.term = ugsub(data.term, diacritics, "")
	data.term = ugsub(data.term, "%-", "")
	data.term = ugsub(data.term, "{.+}", "")
	if data.term:match".+//.+" then
		cls_term, ir_term = match( data.term , "(.*)//(.*)" )
		if cls_term == ir_term then
			data.term = cls_term
		else 
			error("The Classical Persian term and the Iranian Persian term linked to different pages. If automatic transliteration is not possible, enter a manual transliteration instead.")
		end end
	data.term = ugsub(data.term, "\1", "//")
	data.term = ugsub(data.term, "\2", "-")
	data.term = ugsub(data.term, "\3", "{")
	return m_links.full_link(data, options.face, not options.disableSelfLink)
	end

function export.show(frame)
	local boolean = {type = "boolean"}
	local plain = {}
	local args = require("Module:parameters").process(frame:getParent().args, {
		 = {required=true},
		 = plain,
		 = plain,
		 = {alias_of = 'gloss'},
		 = {allow_empty = true},
		 = {alias_of = tr },
		 = plain,
		 = plain,
		 = plain,
		 = {type = "boolean", default = false},
	})

	return export.link({
	term = args,
	lang = require('Module:languages').getByCode('fa'),
	id = args,
	tr = args or args,
	gloss = args,
	pos = args,
	lit = args,
	disableSelfLink = args,
})

end

return export