<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.bharatpedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AMain_page_feed</id>
	<title>Module:Main page feed - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://en.bharatpedia.org/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AMain_page_feed"/>
	<link rel="alternate" type="text/html" href="https://en.bharatpedia.org/w/index.php?title=Module:Main_page_feed&amp;action=history"/>
	<updated>2026-12-02T11:22:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://en.bharatpedia.org/w/index.php?title=Module:Main_page_feed&amp;diff=566101&amp;oldid=prev</id>
		<title>WikiDwarf: Add</title>
		<link rel="alternate" type="text/html" href="https://en.bharatpedia.org/w/index.php?title=Module:Main_page_feed&amp;diff=566101&amp;oldid=prev"/>
		<updated>2026-10-07T09:13:35Z</updated>

		<summary type="html">&lt;p&gt;Add&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Recent events and deaths for the Vector main page.&lt;br /&gt;
-- Reads &amp;quot;YYYY in India&amp;quot; (Events and Deaths). No JavaScript.&lt;br /&gt;
--&lt;br /&gt;
-- {{#invoke:Main page feed|events|5}}&lt;br /&gt;
-- {{#invoke:Main page feed|deaths|5}}&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
local months = {&lt;br /&gt;
	&amp;#039;January&amp;#039;, &amp;#039;February&amp;#039;, &amp;#039;March&amp;#039;, &amp;#039;April&amp;#039;, &amp;#039;May&amp;#039;, &amp;#039;June&amp;#039;,&lt;br /&gt;
	&amp;#039;July&amp;#039;, &amp;#039;August&amp;#039;, &amp;#039;September&amp;#039;, &amp;#039;October&amp;#039;, &amp;#039;November&amp;#039;, &amp;#039;December&amp;#039;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local monthIndex = {}&lt;br /&gt;
for i, name in ipairs(months) do&lt;br /&gt;
	monthIndex[name:lower()] = i&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function istNow()&lt;br /&gt;
	-- Server clock is UTC. India is UTC+5:30.&lt;br /&gt;
	return os.date(&amp;#039;!*t&amp;#039;, os.time() + 19800)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function pageContent(year)&lt;br /&gt;
	local title = mw.title.new(tostring(year) .. &amp;#039; in India&amp;#039;)&lt;br /&gt;
	if not title or not title.exists then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	return title:getContent() or &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function chapter(text, name)&lt;br /&gt;
	local _, finish = text:find(&amp;#039;==%s*&amp;#039; .. name .. &amp;#039;%s*==&amp;#039;)&lt;br /&gt;
	if not finish then&lt;br /&gt;
		return &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	local rest = text:sub(finish + 1)&lt;br /&gt;
	local nextHeading = rest:find(&amp;#039;\n==[^=]&amp;#039;)&lt;br /&gt;
	if nextHeading then&lt;br /&gt;
		rest = rest:sub(1, nextHeading - 1)&lt;br /&gt;
	end&lt;br /&gt;
	return rest&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function clean(text)&lt;br /&gt;
	text = text:gsub(&amp;#039;&amp;lt;ref[^&amp;gt;]-/&amp;gt;&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	text = text:gsub(&amp;#039;&amp;lt;ref.-&amp;gt;.-&amp;lt;/ref&amp;gt;&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	text = text:gsub(&amp;#039;{{[^{}]-}}&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	text = text:gsub(&amp;#039;%s+&amp;#039;, &amp;#039; &amp;#039;)&lt;br /&gt;
	text = text:gsub(&amp;#039;^%s+&amp;#039;, &amp;#039;&amp;#039;):gsub(&amp;#039;%s+$&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	text = text:gsub(&amp;#039;[%.%s]+$&amp;#039;, &amp;#039;&amp;#039;)&lt;br /&gt;
	return text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function parseDated(section, year)&lt;br /&gt;
	local items = {}&lt;br /&gt;
	local currentDay, currentMonth&lt;br /&gt;
	for line in (section .. &amp;#039;\n&amp;#039;):gmatch(&amp;#039;(.-)\n&amp;#039;) do&lt;br /&gt;
		local day, monthName, rest = line:match(&amp;#039;^%*+%s*(%d%d?)%s+(%a+)%s*[–—%-]%s*(.*)$&amp;#039;)&lt;br /&gt;
		if day and monthIndex[monthName:lower()] then&lt;br /&gt;
			currentDay = tonumber(day)&lt;br /&gt;
			currentMonth = monthIndex[monthName:lower()]&lt;br /&gt;
			rest = clean(rest or &amp;#039;&amp;#039;)&lt;br /&gt;
			if rest ~= &amp;#039;&amp;#039; then&lt;br /&gt;
				table.insert(items, {&lt;br /&gt;
					day = currentDay,&lt;br /&gt;
					month = currentMonth,&lt;br /&gt;
					year = year,&lt;br /&gt;
					text = rest&lt;br /&gt;
				})&lt;br /&gt;
			end&lt;br /&gt;
		elseif currentDay and line:match(&amp;#039;^%*+%s*%S&amp;#039;) then&lt;br /&gt;
			local text = clean(line:gsub(&amp;#039;^%*+%s*&amp;#039;, &amp;#039;&amp;#039;))&lt;br /&gt;
			if text ~= &amp;#039;&amp;#039; then&lt;br /&gt;
				table.insert(items, {&lt;br /&gt;
					day = currentDay,&lt;br /&gt;
					month = currentMonth,&lt;br /&gt;
					year = year,&lt;br /&gt;
					text = text&lt;br /&gt;
				})&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return items&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function stamp(item)&lt;br /&gt;
	return item.year * 10000 + item.month * 100 + item.day&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function collect(kind, limit)&lt;br /&gt;
	local now = istNow()&lt;br /&gt;
	local today = now.year * 10000 + now.month * 100 + now.day&lt;br /&gt;
	local year = now.year&lt;br /&gt;
	local text = pageContent(year)&lt;br /&gt;
	local items = parseDated(chapter(text, kind), year)&lt;br /&gt;
&lt;br /&gt;
	local function keep(list)&lt;br /&gt;
		local out = {}&lt;br /&gt;
		for _, item in ipairs(list) do&lt;br /&gt;
			if stamp(item) &amp;lt;= today then&lt;br /&gt;
				table.insert(out, item)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return out&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	items = keep(items)&lt;br /&gt;
	if #items &amp;lt; limit then&lt;br /&gt;
		local prevMonth = now.month - 1&lt;br /&gt;
		local prevYear = year&lt;br /&gt;
		local prevText = text&lt;br /&gt;
		if prevMonth &amp;lt; 1 then&lt;br /&gt;
			prevMonth = 12&lt;br /&gt;
			prevYear = year - 1&lt;br /&gt;
			prevText = pageContent(prevYear)&lt;br /&gt;
		end&lt;br /&gt;
		local older = parseDated(chapter(prevText, kind), prevYear)&lt;br /&gt;
		for _, item in ipairs(keep(older)) do&lt;br /&gt;
			if item.month == prevMonth then&lt;br /&gt;
				table.insert(items, item)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	table.sort(items, function(a, b)&lt;br /&gt;
		return stamp(a) &amp;gt; stamp(b)&lt;br /&gt;
	end)&lt;br /&gt;
&lt;br /&gt;
	local out = {}&lt;br /&gt;
	for i = 1, math.min(limit, #items) do&lt;br /&gt;
		out[i] = items[i]&lt;br /&gt;
	end&lt;br /&gt;
	return out, year&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function render(items, empty)&lt;br /&gt;
	if #items == 0 then&lt;br /&gt;
		return empty&lt;br /&gt;
	end&lt;br /&gt;
	local lines = {}&lt;br /&gt;
	for _, item in ipairs(items) do&lt;br /&gt;
		table.insert(lines, string.format(&lt;br /&gt;
			&amp;#039;* \&amp;#039;\&amp;#039;\&amp;#039;%d %s\&amp;#039;\&amp;#039;\&amp;#039; – %s&amp;#039;,&lt;br /&gt;
			item.day,&lt;br /&gt;
			months[item.month],&lt;br /&gt;
			item.text&lt;br /&gt;
		))&lt;br /&gt;
	end&lt;br /&gt;
	return table.concat(lines, &amp;#039;\n&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.events(frame)&lt;br /&gt;
	local limit = tonumber(frame.args[1]) or 5&lt;br /&gt;
	local items = collect(&amp;#039;Events&amp;#039;, limit)&lt;br /&gt;
	return render(items, &amp;#039;* No recent events listed.&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.deaths(frame)&lt;br /&gt;
	local limit = tonumber(frame.args[1]) or 5&lt;br /&gt;
	local items = collect(&amp;#039;Deaths&amp;#039;, limit)&lt;br /&gt;
	return render(items, &amp;#039;* No recent deaths listed.&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>WikiDwarf</name></author>
	</entry>
</feed>