Diqqət! 4 aprel 2024-cü il tarixdən saytın yeni versiyası sheki.org domenində fəaliyyət göstərir. Bu köhnə versiyadır və yenilənməsi məhdudlaşdırılıb. Lakin 6 yanvar 2025-ci il tarixədək bu vəziyyətdə internetdə qalacaqdır...

"Module:Ordinal" səhifəsinin versiyaları arasındakı fərqlər

Şəki Ensiklopediyası səhifəsi
Jump to navigation Jump to search
(Səhifəni '-- Ordinals for Azerbaijani by RexxS -- Takes a number and returns its ordinal. local suffixes = { "ci", "ci", "cü", "cü", "ci", "cı", "ci", "ci", "cu", [0] = "cu", [...' ilə yarat)
 
 
(Eyni redaktor tərəfindən edilmiş 5 dəyişiklik göstərilmir)
Sətir 1: Sətir 1:
-- Ordinals for Azerbaijani by RexxS
+
local p = {}
-- Takes a number and returns its ordinal.
+
 
 +
local yesno = require('Module:Yesno')
  
 
local suffixes = {
 
local suffixes = {
Sətir 7: Sətir 8:
 
}
 
}
  
function ordinal(number)
+
function p.Ordinal(frame)
local suffix
+
local args = frame.args
if number == 0 then
+
    if args[1] == nil then
suffix = "cı"
+
        args = frame:getParent().args
elseif number % 1000 == 0 then
+
    end
suffix = "ci"
+
    if args[1] == nil then
elseif number %100 == 0 then
+
    args[1] = "{{{1}}}"
suffix = "cü"
+
    end
elseif number %10 == 0 then
+
    return p._ordinal(args[1], (args[2] == 'd'), yesno(args.sup))
suffix = suffixes[number % 100]
 
else
 
suffix = suffixes[number %10] or ""
 
end
 
return number .. "-" .. suffix
 
 
end
 
end
  
-- Global inYear function
+
function p._ordinal(n, d, sup)
function inYear( year )
+
local x = tonumber(mw.ustring.match(n, "(%d*)%W*$"))
if year >= 0 then
+
local suffix = "ci"
    return ordinal(year)
+
if x then
else
+
local mod10 = math.abs(x) % 10
    year = -year
+
local mod100 = math.abs(x) % 100
    return 'e.ə. ' .. ordinal(year)  
+
local mod1000 = math.abs(x) % 1000
 +
if x == 0 then
 +
suffix = "cı"
 +
elseif mod1000 == 0 then
 +
suffix = "ci"
 +
elseif mod100 == 0 then
 +
suffix = "cü"
 +
elseif mod10 == 0 then
 +
suffix = suffixes[x % 100]
 +
else
 +
suffix = suffixes[x %10] or ""
 
end
 
end
end
 
 
-- Global checkApril function
 
function checkApril(elseThanApril, displaySuffixMonth)
 
if (elseThanApril == 4 or elseThanApril == '[Aa]prel') then
 
return displaySuffixMonth .. 'də'
 
else
 
return displaySuffixMonth .. 'da'
 
 
end
 
end
end
+
if sup then
 
+
suffix = "<sup>" .. suffix .. "</sup>"
-- Just for testing by allowing a #invoke: call
+
end
p = {}
+
return n .. '-' .. suffix
 
 
function p.Ordinal(frame)
 
number = tonumber(frame.args[1] or frame.args.number) or 0
 
return ordinal(number)
 
 
end
 
end
  
 
return p
 
return p

Səhifəsinin 02:18, 31 dekabr 2023 tarixinə olan son halı

Bu modulun təlimatı üçün bu səhifə yaradıla bilər: Module:Ordinal/doc

local p = {}

local yesno = require('Module:Yesno')

local suffixes = {
	"ci", "ci", "cü", "cü", "ci", "cı", "ci", "ci", "cu", [0] = "cu", [10] = "cu", [20] = "ci",
	[30] = "cu", [40] = "cı", [50] = "ci", [60] = "cı", [70] = "ci", [80] = "ci", [90] = "cı"
}

function p.Ordinal(frame)
	local args = frame.args
    if args[1] == nil then
        args = frame:getParent().args
    end
    if args[1] == nil then
    	args[1] = "{{{1}}}"
    end
    return p._ordinal(args[1], (args[2] == 'd'), yesno(args.sup))
end

function p._ordinal(n, d, sup)
	local x = tonumber(mw.ustring.match(n, "(%d*)%W*$"))
	local suffix = "ci"
	if x then
		local mod10 = math.abs(x) % 10
		local mod100 = math.abs(x) % 100
		local mod1000 = math.abs(x) % 1000
		if x == 0 then
			suffix = "cı"
		elseif mod1000 == 0 then
			suffix = "ci"
		elseif mod100 == 0 then
			suffix = "cü"
		elseif mod10 == 0 then
			suffix = suffixes[x % 100]
		else
			suffix = suffixes[x %10] or ""
		end
	end
	if sup then
		suffix = "<sup>" .. suffix .. "</sup>"
	end
	return n .. '-' .. suffix
end

return p