Modul:ar-usex/templates

Üdvözlöm, Ön a Modul:ar-usex/templates szó jelentését keresi. A DICTIOUS-ban nem csak a Modul:ar-usex/templates szó összes szótári jelentését megtalálod, hanem megismerheted az etimológiáját, a jellemzőit és azt is, hogyan kell a Modul:ar-usex/templates szót egyes és többes számban mondani. Minden, amit a Modul:ar-usex/templates szóról tudni kell, itt található. A Modul:ar-usex/templates szó meghatározása segít abban, hogy pontosabban és helyesebben fogalmazz, amikor beszélsz vagy írsz. AModul:ar-usex/templates és más szavak definíciójának ismerete gazdagítja a szókincsedet, és több és jobb nyelvi forráshoz juttat.

A modult a Modul:ar-usex/templates/doc lapon tudod dokumentálni

local export = {}

local m_languages = require("Module:0languages")
local rsplit = mw.text.split
local rfind = mw.ustring.find

function export.usex_t(frame)
	local params = {
		 = {required = true},
		 = {},
		 = {},
		
		 = {type = "boolean"},
		 = {type = "boolean"},
		 = {},
		 = {},
		 = {list = true},
		 = {},
		 = {},
		 = {},
		 = {},
		 = {alias_of = 3},
		 = {alias_of = 3},
		 = {},
		 = {alias_of = "tr"},
		 = {},
		 = {alias_of = "ts"},
		 = {type = "boolean"},
		 = {type = "boolean"},
		 = {},
	}
	
	local quote = (frame.args or "") ~= ""
	local compat = (frame.args or "") ~= ""
	local template_inline = (frame.args or "") ~= ""
	local template_nocat = (frame.args or "") ~= ""
	local class = frame.args
	
	if compat then
		params = {required = true}
		params.alias_of = 2
		params.alias_of = 2
		table.remove(params, 1)
	end
	
	local args = require("Module:0parameters").process(frame:getParent().args, params)
	
	local lang = args or "und"
	local sc = args
	
	local data = {
		lang = m_languages.getByCode(lang, compat and "lang" or 1),
		sc = (sc and require("Module:0scripts").getByCode(sc, true) or nil),
		usex = args,
		translation = args,
		transliteration = args,
		transcription = args,
		noenum = args,
		inline = args or template_inline,
		ref = args,
		quote = quote,
		lit = args,
		substs = args,
		qualifiers = args,
		source = args,
		footer = args,
		nocat = args or template_nocat,
		brackets = args,
		sortkey = args,
		class = class,
	}
	
	return require("Module:ar-usex").format_usex(data)
end

-- Given a comma-separated list of language codes, return the English equivalent.
function export.format_langs(frame)
	local langcodes = rsplit(frame.args, ",")
	local langnames = {}
	for _, langcode in ipairs(langcodes) do
		local lang = m_languages.getByCode(langcode) or m_languages.err(langcode, 1)
		table.insert(langnames, lang:getCanonicalName())
	end
	if #langnames == 1 then
		return langnames
	elseif #langnames == 2 then
		return langnames .. " and " .. langnames
	else
		local retval = {}
		for i, langname in ipairs(langnames) do
			table.insert(retval, langname)
			if i <= #langnames - 2 then
				table.insert(retval, ", ")
			elseif i == #langnames - 1 then
				table.insert(retval, "<span class=\"serial-comma\">,</span><span class=\"serial-and\"> and</span> ")
			end
		end
		return table.concat(retval, "")
	end
end

-- Given a comma-separated list of language codes, return the first one.
function export.first_lang(frame)
	local langcodes = rsplit(frame.args, ",")
	return langcodes
end

local ignore_prefixes = {"User:", "Talk:",
	"Wiktionary:Beer parlour", "Wiktionary:Translation requests",
	"Wiktionary:Grease pit", "Wiktionary:Etymology scriptorium",
	"Wiktionary:Information desk", "Wiktionary:Tea room",
	"Wiktionary:Requests for", "Wiktionary:Votes"
}

function export.page_should_be_ignored(page)
	-- Ignore user pages, talk pages and certain Wiktionary pages
	for _, ip in ipairs(ignore_prefixes) do
		if rfind(page, "^" .. ip) then
			return true
		end
	end
	if rfind(page, " talk:") then
		return true
	end
	return false
end

function export.page_should_be_ignored_t(frame)
	return export.page_should_be_ignored(frame.args) and "true" or ""
end

return export