<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ar">
	<id>https://3rabica.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3AGet_year</id>
	<title>وحدة:Get year - تاريخ المراجعة</title>
	<link rel="self" type="application/atom+xml" href="https://3rabica.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3AGet_year"/>
	<link rel="alternate" type="text/html" href="https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Get_year&amp;action=history"/>
	<updated>2026-06-05T06:50:34Z</updated>
	<subtitle>تاريخ التعديل لهذه الصفحة في الويكي</subtitle>
	<generator>MediaWiki 1.43.7</generator>
	<entry>
		<id>https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Get_year&amp;diff=2325&amp;oldid=prev</id>
		<title>عبد العزيز في 23:23، 27 أغسطس 2023</title>
		<link rel="alternate" type="text/html" href="https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Get_year&amp;diff=2325&amp;oldid=prev"/>
		<updated>2023-08-27T23:23:14Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;صفحة جديدة&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local p = {}&lt;br /&gt;
-- {{#invoke:Get year|year|+1|y=2016}}&lt;br /&gt;
-- {{#invoke:Get year|year|+1|y=2016–17}}&lt;br /&gt;
-- {{#invoke:Get year|year|+1|y=2016–17}}&lt;br /&gt;
&lt;br /&gt;
function trim(s)&lt;br /&gt;
	-- from PiL2 20.4&lt;br /&gt;
	return (s:gsub(&amp;quot;^%s*(.-)%s*$&amp;quot;, &amp;quot;%1&amp;quot;))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function get_year(y, Type)&lt;br /&gt;
	if mw.ustring.match(y, &amp;quot;^%d%d%d%d$&amp;quot;) then&lt;br /&gt;
		return tonumber(y) + (Type == &amp;quot;+1&amp;quot; and 1 or -1)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local hyph, finish = mw.ustring.match(y, &amp;quot;%d([%–-])(%d+)&amp;quot;)&lt;br /&gt;
	finish = finish or &amp;quot;&amp;quot;&lt;br /&gt;
	if not string.match(finish, &amp;quot;^%d+$&amp;quot;) then&lt;br /&gt;
		local finish_fixed = mw.ustring.match(finish, &amp;quot;^%s*(%d%d?%d?%d?)%D&amp;quot;)&lt;br /&gt;
		if finish_fixed then&lt;br /&gt;
			finish = finish_fixed&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;#039;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	elseif string.len(finish) &amp;gt;= 5 then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local start = string.match(y, &amp;quot;^%d+&amp;quot;) or &amp;quot;&amp;quot;&lt;br /&gt;
	if not string.match(start, &amp;quot;^%d%d?%d?%d?$&amp;quot;) then&lt;br /&gt;
		local start_fixed = mw.ustring.match(start, &amp;quot;^%s*(%d%d?%d?%d?)%D&amp;quot;)&lt;br /&gt;
		if start_fixed then&lt;br /&gt;
			start = start_fixed&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local nstart = tonumber(start)&lt;br /&gt;
	local nfinish = tonumber(finish)&lt;br /&gt;
	local t = 1&lt;br /&gt;
	while t &amp;lt;= 10 do&lt;br /&gt;
		local nish = nstart + t&lt;br /&gt;
		if nish == nfinish or string.match(nish, &amp;quot;%d?%d$&amp;quot;) == finish then&lt;br /&gt;
			break&lt;br /&gt;
		end&lt;br /&gt;
		if t == 10 then&lt;br /&gt;
			errors =&lt;br /&gt;
				p.errorclass(&lt;br /&gt;
				&amp;#039;Function nav_hyphen can\&amp;#039;t determine a reasonable term length for &amp;quot;&amp;#039; .. start .. hyph .. finish .. &amp;#039;&amp;quot;.&amp;#039;&lt;br /&gt;
			)&lt;br /&gt;
			return p.failedcat(errors, &amp;quot;K&amp;quot;)&lt;br /&gt;
		end&lt;br /&gt;
		t = t + 1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local i = Type == &amp;quot;+1&amp;quot; and 1 or -1&lt;br /&gt;
	local hgap = 0&lt;br /&gt;
	local from = nstart + i * (t + hgap)&lt;br /&gt;
	local from2 = string.match(from, &amp;quot;%d?%d$&amp;quot;)&lt;br /&gt;
	local to = tostring(from + t)&lt;br /&gt;
	local to2 = string.match(to, &amp;quot;%d?%d$&amp;quot;)&lt;br /&gt;
	local tofinal = (t &amp;gt; 1 or (from2 - to2) &amp;gt; 0) and to or to2&lt;br /&gt;
&lt;br /&gt;
	local full = from .. hyph .. tofinal&lt;br /&gt;
	local abbr = from .. hyph .. to2&lt;br /&gt;
&lt;br /&gt;
	return full&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.year(frame)&lt;br /&gt;
	local args = frame.args&lt;br /&gt;
	local y = args.y or args.year or &amp;quot;&amp;quot;&lt;br /&gt;
	local Type = args[&amp;quot;1&amp;quot;] or args.ty or args.type or &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	if y == &amp;quot;&amp;quot; or Type == &amp;quot;&amp;quot; then&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return get_year(y, Type)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.get(frame)&lt;br /&gt;
    local args = frame.args&lt;br /&gt;
&lt;br /&gt;
    local title = args[&amp;quot;1&amp;quot;] or args.pa or args.page or args.title&lt;br /&gt;
    local Type = args[&amp;quot;2&amp;quot;] or args.ty or args.type&lt;br /&gt;
&lt;br /&gt;
    if title == &amp;quot;&amp;quot; or Type == &amp;quot;&amp;quot; then&lt;br /&gt;
        return &amp;quot;&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    title = trim(title)&lt;br /&gt;
    Type = trim(Type)&lt;br /&gt;
&lt;br /&gt;
    local year =&lt;br /&gt;
        mw.ustring.match(title, &amp;quot;%s%d%d%d%d[%–-]%d%d%d%d$&amp;quot;, 1) or mw.ustring.match(title, &amp;quot;%s%d%d[%–-]%d%d%d%d$&amp;quot;, 1) or&lt;br /&gt;
        mw.ustring.match(title, &amp;quot;%s%d%d%d%d[%–-]%d%d$&amp;quot;, 1) or&lt;br /&gt;
        mw.ustring.match(title, &amp;quot;%s%d%d%d%d$&amp;quot;, 1) or&lt;br /&gt;
        mw.ustring.match(title, &amp;quot;^%d%d%d%d%s&amp;quot;, 1) or&lt;br /&gt;
        mw.ustring.match(title, &amp;quot;%s%d%d%d%d%s&amp;quot;, 1) or&lt;br /&gt;
        &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
    year = trim(year)&lt;br /&gt;
    &lt;br /&gt;
    if year == &amp;quot;&amp;quot; then&lt;br /&gt;
        mw.log(&amp;quot;no year&amp;quot;)&lt;br /&gt;
        return &amp;quot;&amp;quot;&lt;br /&gt;
    end&lt;br /&gt;
    &lt;br /&gt;
    mw.log(&amp;quot;year:&amp;quot; .. year .. &amp;quot;;Type:&amp;quot; .. Type .. &amp;quot;;title:&amp;quot; .. title)&lt;br /&gt;
    local y2 = year:gsub(&amp;quot;%-&amp;quot;, &amp;quot;%%-&amp;quot;)&lt;br /&gt;
    if Type == &amp;quot;year&amp;quot; or Type == &amp;quot;y&amp;quot; then&lt;br /&gt;
        return year&lt;br /&gt;
        &lt;br /&gt;
    elseif Type == &amp;quot;noyear&amp;quot; or Type == &amp;quot;noy&amp;quot; then&lt;br /&gt;
		local t3 = title:gsub(&amp;quot;^(.-)%s&amp;quot; .. y2, &amp;quot;%1&amp;quot;)&lt;br /&gt;
		return t3&lt;br /&gt;
    elseif Type == &amp;quot;+1&amp;quot; or Type == &amp;quot;-1&amp;quot; then&lt;br /&gt;
        return get_year(year, Type)&lt;br /&gt;
        &lt;br /&gt;
    elseif Type == &amp;quot;title+1&amp;quot; or Type == &amp;quot;title-1&amp;quot; then&lt;br /&gt;
        local tyt = &amp;quot;+1&amp;quot; and Type == &amp;quot;title+1&amp;quot; or &amp;quot;-1&amp;quot;&lt;br /&gt;
        year_2 = get_year(year, tyt)&lt;br /&gt;
        title3 = title:gsub(&amp;quot;^(.-)%s&amp;quot; .. y2, &amp;quot;%1&amp;quot;) .. &amp;quot; &amp;quot; .. year_2&lt;br /&gt;
        return title3&lt;br /&gt;
    end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>عبد العزيز</name></author>
	</entry>
</feed>