Butun axtardiqlarinizi tapmaq ucun buraya: DAXIL OLUN
  Mp4 Mp3 Axtar Yukle
  Video Axtar Yukle
  Shekil Axtar Yukle
  Informasiya Melumat Axtar
  Hazir Inshalar Toplusu
  AZERI CHAT + Tanishliq
  Saglamliq Tibbi Melumat
  Whatsapp Plus Yukle(Yeni)

  • Ana səhifə
  • Təsadüfi
  • Yaxınlıqdakılar
  • Daxil ol
  • Nizamlamalar
İndi ianə et Əgər Vikipediya sizin üçün faydalıdırsa, bu gün ianə edin.

Modul:Citation/Dates

  • Modul
  • Müzakirə
< Modul:Citation

Bu modulun sənədləşdirmə səhifəsi Modul:Citation/Dates/doc səhifəsində yaradıla bilər

local p = {}

local Ordinal = require('Modul:Ordinal')

p.months = {
	az = {'yanvar','fevral','mart','aprel','may','iyun','iyul','avqust','sentyabr','oktyabr','noyabr','dekabr'}
}

local function normalize(str)
	return (str or ''):gsub('[/%-]', '.'):gsub('%s+', '')
end

local function parseDate(s)
	s = normalize(s)
	local d, m, y = s:match('^(%d%d?)%.(%d%d?)%.(%d%d%d%d)$')
	if d then return tonumber(d), tonumber(m), tonumber(y) end
	y, m, d = s:match('^(%d%d%d%d)%.(%d%d?)%.(%d%d?)$')
	if y then return tonumber(d), tonumber(m), tonumber(y) end
	m, y = s:match('^(%d%d?)%.(%d%d%d%d)$')
	if m then return nil, tonumber(m), tonumber(y) end
	y, m = s:match('^(%d%d%d%d)%.(%d%d?)$')
	if y then return nil, tonumber(m), tonumber(y) end
	return nil
end

local function formatMainDate(input, lang)
	local d, m, y = parseDate(input)
	if not y then return mw.text.trim(input) end
	local months = p.months.az
	if d and m then
		return string.format('%d %s %d', d, months[m], y)
	elseif m then
		return string.format('%s %d', months[m], y)
	else
		return tostring(y)
	end
end

function p.format(input, lang, context, archiveText, accessText)
	if context == 'archive' then
		local hasDate = input and input ~= ''
		local hasURL  = archiveText and archiveText ~= ''

		if not hasDate and not hasURL then
			return ''
		end

		if hasURL and not hasDate then
			return string.format('[%s Arxivləşdirilib]', archiveText)
		end

		if hasDate and not hasURL then
			return ''
		end

		if input:find('%a') or input:find('[%z\1-\127\194-\244][^\128-\191]*') and not input:match('^%d+[%.%/%-]?%d*[%.%/%-]?%d*$') then
			if hasURL then
				return string.format('%s tarixində [%s arxivləşdirilib]', mw.text.trim(input), archiveText)
			else
				return string.format('%s tarixində arxivləşdirilib', mw.text.trim(input))
			end
		end

		local d, m, y = parseDate(input)
		if not y then
			return string.format('%s tarixində [%s arxivləşdirilib]', mw.text.trim(input), archiveText)
		end

		local months = p.months.az
		local text
		if d and m then
			text = string.format('%d %s %s', d, months[m], makeOrdinal(y))
		elseif m then
			text = string.format('%s %s', months[m], makeOrdinal(y))
		else
			text = makeOrdinal(y)
		end

		return string.format('%s ildə [%s arxivləşdirilib]', text, archiveText)
	end

	if context == 'access' then
		if not input or input == '' then return '' end
		local d, m, y = parseDate(input)
		if not y then return mw.text.trim(input) end
		local months = p.months.az
		local text
		if d and m then
			text = string.format('%d %s %d', d, months[m], y)
		elseif m then
			text = string.format('%s %d', months[m], y)
		else
			text = tostring(y)
		end
		return 'İstifadə tarixi: ' .. text
	end

	if not input or input == '' then return '' end
	return formatMainDate(input, lang)
end

function p.combine(mainDate, archivePart, accessPart)
	local out = mainDate
	if (archivePart ~= '' and archivePart ~= nil) or (accessPart ~= '' and accessPart ~= nil) then
		local combined = ''
		if archivePart and archivePart ~= '' then
			combined = combined .. archivePart
			if accessPart and accessPart ~= '' then
				combined = combined .. ' ' .. accessPart
			end
		elseif accessPart and accessPart ~= '' then
			combined = accessPart
		end
		out = out .. ' (<small>' .. mw.text.trim(combined) .. '</small>)'
	end
	return out
end

return p
Mənbə — "https://az.wikipedia.org/w/index.php?title=Modul:Citation/Dates&oldid=8343431"
Informasiya Melumat Axtar